我一个图表中X轴是日期,Y轴就两项,一个是数量,另一个是金额,结果在图例区会显示三个:蓝色: Series1
澄色: 数量
红色: 金额这是为什么?但是用 Chart1.Series["Series1"].IsVisibleInLegend = false; 可以把它隐藏掉,只是搞不明白.Chart1.Series["Series1"] 这个不是指 数量吗?
前台chart中有:
<legends>
    <asp:Legend IsTextAutoFit="False" Name="Default" BackColor="Transparent" Font="Trebuchet MS, 8.25pt, style=Bold">
    </asp:Legend>
</legends>
后台绑定:
sql="SELECT A.TG003 月份,SUM(TH8) 数量,SUM(TH37) 金额 FROM ...";
Chart1.DataBindTable(ds.Tables[0].DefaultView, "月份");  // 绑定 X 轴数据列
Chart1.Series[0].ChartArea = "ChartArea1";
Chart1.Series[1].ChartArea = "ChartArea2";按理说Chart1.Series[0]应该是数量,Chart1.Series[1]应该是金额,但是在Chart图表上却是反过来的,两个ChartArea,
ChartArea1显示的是金额的信息, ChartArea2显示的数量的信息.
Chart1.Series[0].ChartArea = "ChartArea1";
Chart1.Series[1].ChartArea = "ChartArea2";
这两句如果把等号右边反过来写就会两个在一个ChartArea中,不符合要求.谁能详细解释一下?

解决方案 »

  1.   

    前台只有一个 Series 呀,下面是前台的代码:    <asp:chart id="Chart1" runat="server" Height="500px" Width="800px" 
                Palette="BrightPastel" imagetype="Png" 
                BorderDashStyle="Solid" BackSecondaryColor="White" 
                BackGradientStyle="TopBottom" BorderWidth="2" backcolor="#D3DFF0" 
                BorderColor="26, 59, 105">
            <legends>
                <asp:Legend IsTextAutoFit="False" Name="Default" BackColor="Transparent" Font="Trebuchet MS, 8.25pt, style=Bold">
                </asp:Legend>
            </legends>
            <borderskin skinstyle="Emboss"></borderskin>
            <series>
                <asp:Series Name="Series1" BorderColor="180, 26, 59, 105"></asp:Series>
            </series>
            <chartareas>
                <asp:ChartArea Name="ChartArea1" BorderColor="64, 64, 64, 64" BorderDashStyle="Solid" BackSecondaryColor="White" 
                        BackColor="64, 165, 191, 228" ShadowColor="Transparent" BackGradientStyle="TopBottom">
                    <area3dstyle Rotation="10" perspective="10" Inclination="15" IsRightAngleAxes="False" wallwidth="0" IsClustered="False"></area3dstyle>
                    <axisy linecolor="64, 64, 64, 64">
                        <labelstyle font="Trebuchet MS, 8.25pt, style=Bold" />
                        <majorgrid linecolor="64, 64, 64, 64" />
                    </axisy>
                    <axisx linecolor="64, 64, 64, 64">
                        <labelstyle font="Trebuchet MS, 8.25pt, style=Bold" />
                        <majorgrid linecolor="64, 64, 64, 64" />
                    </axisx>
                </asp:ChartArea>
                <asp:ChartArea Name="ChartArea2" BorderColor="64, 64, 64, 64" BorderDashStyle="Solid" BackSecondaryColor="White" 
                        BackColor="64, 165, 191, 228" ShadowColor="Transparent" BackGradientStyle="TopBottom">
                    <area3dstyle Rotation="10" perspective="10" Inclination="15" IsRightAngleAxes="False" wallwidth="0" IsClustered="False"></area3dstyle>
                    <axisy linecolor="64, 64, 64, 64">
                        <labelstyle font="Trebuchet MS, 8.25pt, style=Bold" />
                        <majorgrid linecolor="64, 64, 64, 64" />
                    </axisy>
                    <axisx linecolor="64, 64, 64, 64">
                        <labelstyle font="Trebuchet MS, 8.25pt, style=Bold" />
                        <majorgrid linecolor="64, 64, 64, 64" />
                    </axisx>
                </asp:ChartArea>
            </chartareas>
        </asp:chart>