ASP Chart Control - 显示所有SQL数据的问题

时间:2015-04-01 16:41:04

标签: asp.net mschart

我是使用MSChart控件的新手。我知道如何在柱形图中显示单个系列数据,但是在图表中显示多个数据值时遇到问题。以下是我需要显示的SQL查询中的数据:

Area      TotalCnt   Compliant  CPercent     NonCompliant   NCPercent
Area1      29027      25468      87.7            3559        12.3
Area2      13659      12035      88.1            1624        11.9
Area3      25358      22221      87.6            3137        12.4
Area4      47747      42340      88.7            5407        11.3

这是我的柱形图的系列部分:

<series>
<asp:series IsValueShownAsLabel="true" ChartArea="ChartArea1" Label="#VALY" Name="Compliant" BorderColor="180, 26, 59, 105" Color="#00CC00" XValueMember="Area" YValueMembers="Compliant"></asp:series>
<asp:series IsValueShownAsLabel="true" ChartArea="ChartArea1" Label="#VALY" Name="Non-Compliant" BorderColor="180, 26, 59, 105" Color="255, 0, 0" XValueMember="Area" YValueMembers="NonCompliant"></asp:series>
</series>

任何帮助将不胜感激。 添加了以下整个图表控件:

<asp:chart id="Chart1" runat="server" DataSourceID="SqlDataSource1" Width="800px" Height="400px" Palette="BrightPastel" BorderColor="181, 64, 1" BorderlineDashStyle="Solid" BackGradientStyle="TopBottom" BorderWidth="2" backcolor="#F3DFC1" imagetype="Png" ImageLocation="~\TempImages\ChartPic_#SEQ(300,3)">
   <titles>
   <asp:title ShadowColor="32, 0, 0, 0" Font="Trebuchet MS, 14.25pt, style=Bold" ShadowOffset="3" Text="DataSource Data Binding" Alignment="TopLeft" ForeColor="26, 59, 105"></asp:title>
   </titles>
    <legends>
        <asp:legend Name="Legend1" Enabled="True" IsTextAutoFit="True" BackColor="Transparent" Font="Trebuchet MS, 8.25pt, style=Bold">
        </asp:legend>
        <asp:Legend HeaderSeparator="Line" Name="Legend2">
                <CellColumns>
                    <asp:LegendCellColumn ColumnType="SeriesSymbol" HeaderText="Region" Name="Column1">
                        <Margins Left="15" Right="15" />
                    </asp:LegendCellColumn>
                </CellColumns>
            </asp:Legend>

    </legends>
    <borderskin skinstyle="Emboss"></borderskin>
        <series>
            <asp:series IsValueShownAsLabel="true" Legend="Legend1" ChartArea="ChartArea1" Label="#VALY" Name="Compliant" BorderColor="180, 26, 59, 105" Color="#00CC00" XValueMember="Area" YValueMembers="Compliant">
            </asp:series>
    <asp:series IsValueShownAsLabel="true" Legend="Legend1" ChartArea="ChartArea1" Label="#VALY" Name="Non-Compliant" BorderColor="180, 26, 59, 105" Color="255, 0, 0" XValueMember="Area" YValueMembers="NonCompliant">
             </asp:series>
        </series>
    <chartareas>
        <asp:chartarea Name="ChartArea1" BorderColor="64, 64, 64, 64" BorderDashStyle="Solid" BackSecondaryColor="White" BackColor="OldLace" ShadowColor="Transparent" BackGradientStyle="TopBottom">
        <area3dstyle Rotation="10" perspective="10" Inclination="15" IsRightAngleAxes="False" wallwidth="0" IsClustered="False"></area3dstyle>              
        <axisx linecolor="64, 64, 64, 64" IsLabelAutoFit="False">
        <labelstyle font="Trebuchet MS, 8.25pt, style=Bold" />
        <LabelStyle Enabled="true" />
        <MajorGrid LineWidth="1" />
        <MajorTickMark Enabled="false" />
        </axisx>
        <axisy linecolor="64, 64, 64, 64" IsLabelAutoFit="False">
        <labelstyle font="Trebuchet MS, 8.25pt, style=Bold" />
        <majorgrid linecolor="64, 64, 64, 64" />
        <LabelStyle Enabled="true" />
        <MajorGrid LineWidth="1" />
        <MajorTickMark Enabled="false" />
        </axisy>
    </asp:chartarea>
  </chartareas>
</asp:chart>

0 个答案:

没有答案