图表上的差异是否比实际观看更多?

时间:2014-03-27 15:27:07

标签: asp.net vb.net charts mschart

我正在创建一个包含line和stackedColumns的不同系列的图表。 (参见图1)但当我将线系列更改为点系列时,stackedColumn也改变了(图2)

知道发生了什么事情来改变我的叠加柱图吗?

图片1  Picture 1

图片2 enter image description here

代码:

<asp:Chart ID="chrSteam" runat="server"  >
    <Series>
THIS IS THE ONE I CHANGED-
     <asp:Series Name="Skillnad" ChartArea="chrSteam" Color="Green" ChartType="point"'line BorderWidth="2"></asp:Series>

     <asp:Series Name="serGoodColNeg" ChartArea="chrSteam" Color="Green" ChartType="StackedColumn" BorderWidth="1"></asp:Series>
     <asp:Series Name="serLowCol" ChartArea="chrSteam" Color="#E5E500" ChartType="StackedColumn" BorderWidth="1"></asp:Series>
     <asp:Series Name="serLowLowCol" ChartArea="chrSteam" Color="Red" ChartType="StackedColumn" BorderWidth="1"></asp:Series>
     <asp:Series Name="serGoodColPos" ChartArea="chrSteam" Color="Green" ChartType="StackedColumn" BorderWidth="1"></asp:Series>    
     <asp:Series Name="serLowLimit" ChartArea="chrSteam" Color="#808080" ChartType="StepLine" BorderWidth="1"></asp:Series>
     <asp:Series Name="serLowLowLimit" ChartArea="chrSteam" Color="#808080" ChartType="StepLine" BorderWidth="1"></asp:Series>
    </Series>
   <ChartAreas>
   <asp:ChartArea Name="chrSteam" ></asp:ChartArea>


    'Lines for limits
    For i As Integer = 0 To 8 'Past 7 days
        With chrCurrent
            .Series("serLowLimit").Points.AddXY(DateSerial(Now.Year, Now.Month, Now.Day + 1 - i), (limitGoodNeg))
            .Series("serLowLowLimit").Points.AddXY(DateSerial(Now.Year, Now.Month, Now.Day + 1 - i), (limitYellowLow + limitGoodNeg))
        End With
    Next
    'COLUM
    With chrCurrent

        .Series("serLowCol").Points.AddXY(DateSerial(Now.Year, Now.Month, Now.Day + 1), (limitYellowLow))
        .Series("serLowLowCol").Points.AddXY(DateSerial(Now.Year, Now.Month, Now.Day + 1), (limitYellowLow + limitGoodNeg))
        .Series("serGoodColNeg").Points.AddXY(DateSerial(Now.Year, Now.Month, Now.Day + 1), (limitGoodNeg))
        .Series("serGoodColPos").Points.AddXY(DateSerial(Now.Year, Now.Month, Now.Day + 1), (20))

    End With

1 个答案:

答案 0 :(得分:0)

我需要将位置系列位置更改为最后一个而不是第一个。

 <asp:Series Name="serGoodColNeg" ChartArea="chrSteam" Color="Green" ChartType="StackedColumn" BorderWidth="1"></asp:Series>
 <asp:Series Name="serLowCol" ChartArea="chrSteam" Color="#E5E500" ChartType="StackedColumn" BorderWidth="1"></asp:Series>
 <asp:Series Name="serLowLowCol" ChartArea="chrSteam" Color="Red" ChartType="StackedColumn" BorderWidth="1"></asp:Series>
 <asp:Series Name="serGoodColPos" ChartArea="chrSteam" Color="Green" ChartType="StackedColumn" BorderWidth="1"></asp:Series>    
 <asp:Series Name="serLowLimit" ChartArea="chrSteam" Color="#808080" ChartType="StepLine" BorderWidth="1"></asp:Series>
 <asp:Series Name="serLowLowLimit" ChartArea="chrSteam" Color="#808080" ChartType="StepLine" BorderWidth="1"></asp:Series>
</Series>
THIS IS THE ONE I CHANGED-
 <asp:Series Name="Skillnad" ChartArea="chrSteam" Color="Green" ChartType="point"'line BorderWidth="2"></asp:Series>

'Lines for limits
For i As Integer = 0 To 8 'Past 7 days
    With chrCurrent
        .Series("serLowLimit").Points.AddXY(DateSerial(Now.Year, Now.Month, Now.Day + 1 - i), (limitGoodNeg))
        .Series("serLowLowLimit").Points.AddXY(DateSerial(Now.Year, Now.Month, Now.Day + 1 - i), (limitYellowLow + limitGoodNeg))
    End With
Next
'COLUM
With chrCurrent

    .Series("serLowCol").Points.AddXY(DateSerial(Now.Year, Now.Month, Now.Day + 1), (limitYellowLow))
    .Series("serLowLowCol").Points.AddXY(DateSerial(Now.Year, Now.Month, Now.Day + 1), (limitYellowLow + limitGoodNeg))
    .Series("serGoodColNeg").Points.AddXY(DateSerial(Now.Year, Now.Month, Now.Day + 1), (limitGoodNeg))
    .Series("serGoodColPos").Points.AddXY(DateSerial(Now.Year, Now.Month, Now.Day + 1), (20))

End With