简体   繁体   English

如何设置Stacked =“ true”柱形图telerik

[英]How set Stacked=“true” column chart telerik

I have a column chart, so I would like to chart the values last columns show stacked values. 我有一个柱形图,所以我想以图表的形式显示最后一列的值。

I am using the RadHtmlChart Telerik, but setting parameter tacked="true" in the last columns, but the result its wrong the chart is not stacked, if i set this attribute in the first line serie, the chart is stacked. 我正在使用RadHtmlChart Telerik,但在最后几列中设置了参数sticked =“ true”,但结果是错误的图表未堆叠,如果我在第一行意向中设置了此属性,则该图表将堆叠。 This my code: 这是我的代码:

<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>

thanks for yours comments 谢谢你的评论

Read this to see how to use the feature: http://www.telerik.com/help/aspnet-ajax/htmlchart-stacked-series.html . 阅读此内容以了解如何使用该功能: http : //www.telerik.com/help/aspnet-ajax/htmlchart-stacked-series.html

Read this to see how to get a total in the last series: http://www.telerik.com/forums/need-to-display-grand-total-on-top-of-the-htmlchart-stacked-bars . 阅读本文以了解如何获得上一系列的总和: http : //www.telerik.com/forums/need-to-display-grand-total-on-top-of-the-htmlchart-stacked-bars

Finally I set the property stacked= true in the last column, my code: 最后,在我的代码的最后一列中设置属性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>

the part of code-behind: 代码背后的部分:

 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

the result: 结果:

在此处输入图片说明

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何开发堆积柱形图 - How to develop Stacked Column Chart 如何创建堆积柱形图? - How to create a stacked column chart? 在特定条件为真时如何禁用Telerik radgrid超链接列 - How to disable Telerik radgrid hyperlink column when a specific condition is true 如何在telerik饼图中设置带有%值的标签值 - how to set lable value with their % value in telerik Pie chart 在Telerik Radcalander中将AutoPostBack设置为True的onclient - getting onclient with AutoPostBack set to True in telerik radcalander 如何显示堆积柱形图的轴标签(Asp.net 图表控件)? - How to display Axis Labels for Stacked Column chart ( Asp.net chart control )? 使用Telerik radGrid-如何在编辑模式下设置自动生成的列的日期格式 - Using telerik radGrid - how to set the Date format for autogenerated column in edit mode C#-我们可以为每个堆叠的条形图设置不同的颜色吗? - C# - Can we set different color for each stacked of Stacked bar chart Telerik RadGrid GridDataItem - 如何确定列是否存在? - Telerik RadGrid GridDataItem - how to determine if column exists? Telerik RadGrid-&gt;页脚中(nvarchar)列的总和如何? - Telerik RadGrid -> How SUM of (nvarchar) Column in footer?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM