Как установить столбчатую диаграмму 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>

спасибо за ваши комментарии


person navarend    schedule 06.05.2014    source источник


Ответы (2)


Прочитайте это, чтобы узнать, как использовать эту функцию: http://www.telerik.com/help/aspnet-ajax/htmlchart-stacked-series.html.

Прочитайте это, чтобы узнать, как получить итог в последней серии: http://www.telerik.com/forums/need-to-display-grand-total-on-top-of-the-htmlchart-stacked-bars .

person rdmptn    schedule 07.05.2014

Наконец, я установил свойство stacked= true в последнем столбце, мой код:

<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

результат:

введите здесь описание изображения

person navarend    schedule 07.05.2014