2014-05-06 38 views
0

我有一个柱形图,所以我想绘制最后一列显示堆积值的值。如何设置Stacked =“true”柱形图telerik

我正在使用RadHtmlChart Telerik,但在最后一列设置参数tacked =“true”,但结果错了图表没有堆积,如果我在第一行系列中设置此属性,图表堆叠。这是我的代码:

<telerik:RadHtmlChart ID="Chart" runat="server" Width="680" Height="500"> 
           <PlotArea> 
            <XAxis> 
             <LabelsAppearance> 
              <TextStyle Color="white" FontFamily="Arial" FontSize="13" /> 
             </LabelsAppearance> 
            </XAxis> 
            <YAxis Step="5000000" MinValue="0" > 
             <LabelsAppearance DataFormatString="${0:0,0}"> 
              <TextStyle Color="white" FontFamily="Arial" FontSize="12" /> 
             </LabelsAppearance> 
            </YAxis> 
            <Series> 
             <telerik:ColumnSeries Name="Garantías Vigentes"> 
              <LabelsAppearance Position="Center" DataFormatString="${0:0,0}" > 
               <TextStyle Color="Black" FontFamily="Arial" Bold="True" FontSize="18" /> 
              </LabelsAppearance> 
              <Appearance> 
               <FillStyle BackgroundColor="#87cb50"></FillStyle> 
              </Appearance> 
              <SeriesItems> 
              </SeriesItems> 
             </telerik:ColumnSeries> 
             <telerik:ColumnSeries Name="Saldo Vigente" Stacked="true"> 
              <LabelsAppearance Position="Center" DataFormatString="${0:0,0}"> 
               <TextStyle Color="Black" FontFamily="Arial" Bold="True" FontSize="18" /> 
              </LabelsAppearance> 
              <Appearance> 
               <FillStyle BackgroundColor="#8DB4E2"></FillStyle> 
              </Appearance> 
              <SeriesItems> 
              </SeriesItems> 
             </telerik:ColumnSeries> 
             <telerik:ColumnSeries Name="" Stacked="true"> 
              <LabelsAppearance Position="Center" DataFormatString="${0:0,0}"> 
               <TextStyle Color="Black" FontFamily="Arial" Bold="True" FontSize="18" /> 
              </LabelsAppearance> 
              <Appearance> 
               <FillStyle BackgroundColor="#8DB4E2"></FillStyle> 
              </Appearance> 
              <SeriesItems> 
              </SeriesItems> 
             </telerik:ColumnSeries> 
            </Series> 
           </PlotArea> 
           <Legend> 
            <Appearance Position="Bottom"><TextStyle Color="white" FontFamily="Arial" FontSize="20" Bold="True"/></Appearance> 
           </Legend> 
    </telerik:RadHtmlChart> 

感谢您的评论

回答

0

最后,我设置属性堆叠=在最后一列真实的,我的代码:

<telerik:RadHtmlChart ID="Chart" runat="server" Width="680" Height="500"> 
           <PlotArea> 
            <XAxis> 
             <LabelsAppearance> 
              <TextStyle Color="white" FontFamily="Arial" FontSize="13" /> 
             </LabelsAppearance> 
            </XAxis> 
            <YAxis MinValue="0" > 
             <LabelsAppearance DataFormatString="${0:0,0}"> 
              <TextStyle Color="white" FontFamily="Arial" FontSize="12" /> 
             </LabelsAppearance> 
            </YAxis> 

             <Series> 
             <telerik:ColumnSeries Name="Garantías Vigentes" Stacked="true"> 

              <LabelsAppearance Position="Center" DataFormatString="${0:0,0}"> 
               <TextStyle Color="Black" FontFamily="Arial" Bold="True" FontSize="18" /> 
              </LabelsAppearance> 
              <Appearance> 
               <FillStyle BackgroundColor="#87cb50"></FillStyle> 
              </Appearance> 
              <SeriesItems> 

              </SeriesItems> 
             </telerik:ColumnSeries> 
            </Series> 

            <Series>       
             <telerik:ColumnSeries Name="Saldo Vigente" Stacked="true"> 
              <LabelsAppearance Position="Center" DataFormatString="${0:0,0}"> 
               <TextStyle Color="Black" FontFamily="Arial" Bold="True" FontSize="18" /> 
              </LabelsAppearance> 
              <Appearance> 
               <FillStyle BackgroundColor="#8DB4E2"></FillStyle> 
              </Appearance> 
              <SeriesItems> 
               <telerik:CategorySeriesItem Y="0"></telerik:CategorySeriesItem> 
              </SeriesItems> 
             </telerik:ColumnSeries> 

             <telerik:ColumnSeries Name="" > 
              <LabelsAppearance Position="Center" DataFormatString="${0:0,0}"> 
               <TextStyle Color="Black" FontFamily="Arial" Bold="True" FontSize="0" /> 
              </LabelsAppearance> 
              <Appearance> 
               <FillStyle BackgroundColor="#1B1A1A"></FillStyle> 
              </Appearance> 
              <SeriesItems> 
               <telerik:CategorySeriesItem Y="0"></telerik:CategorySeriesItem> 
              </SeriesItems> 
             </telerik:ColumnSeries> 
            </Series> 
           </PlotArea> 
           <Legend> 
            <Appearance Position="Bottom"><TextStyle Color="white" FontFamily="Arial" FontSize="20" Bold="True"/></Appearance> 
           </Legend> 
     </telerik:RadHtmlChart> 

的部分代码隐藏:

Public Sub LoadChart() 
    Dim salesAuto As Double 
    Dim lessVig As Double 

    lessVig = LtlSaldoVigente.Text.ToDouble 
    salesAuto = CDbl(LtlLine.Text.ToDouble - lessVig * 1000000) 
    Chart.PlotArea.YAxis.MinorGridLines.Visible = False 
    Chart.PlotArea.XAxis.MinorGridLines.Visible = False 


    Dim ColumnSeries1 As ColumnSeries = TryCast(Chart.PlotArea.Series(0), ColumnSeries) 
    ColumnSeries1.SeriesItems.Add(y:=CDec(LtlValue.Text.ToDouble)) 
    ColumnSeries1.SeriesItems.Add(y:=CDec(0)) 

    Dim ColumnSeries2 As ColumnSeries = TryCast(Chart.PlotArea.Series(1), ColumnSeries) 
    ColumnSeries2.Stacked = True 
    ColumnSeries2.SeriesItems.Add(y:=CDec(LtlSaVig.Text.ToDouble * 1000000)) 

    Dim ColumnSeries3 As ColumnSeries = TryCast(Chart.PlotArea.Series(2), ColumnSeries) 
    ColumnSeries3.SeriesItems.Add(y:=CDec(lessVig)) 
End Sub 

结果:

enter image description here