This is a migrated thread and some comments may be shown as answers.

Item Labels in a Stacked Bar Chart

5 Answers 146 Views
Chart (Obsolete)
This is a migrated thread and some comments may be shown as answers.
Paul Smith
Top achievements
Rank 1
Paul Smith asked on 01 Apr 2010, 02:17 AM
Is it possible (and if so how) to only show the total of the bar as the label above it, on a stacked bar chart.
If I turn on item labels, it puts a label for each stack segment, where as I want just the total of all segments to display above the bar.

5 Answers, 1 is accepted

Sort by
0
Accepted
Ves
Telerik team
answered on 02 Apr 2010, 08:26 AM
Hi Paul,

You can hide the labels for all the series, except for the last one. For it, you can use the #STSUM token to display the stacked sum. Here is an example:

<telerik:RadChart runat="server" ID="RadChart1" AutoLayout="True" >
           <Series>
               <telerik:ChartSeries Name="Series 1" Type="StackedBar">
                   <Appearance>
                       <LabelAppearance Visible="False">
                       </LabelAppearance>
                   </Appearance>
                   <Items>
                       <telerik:ChartSeriesItem Name="Item 1" YValue="3">
                       </telerik:ChartSeriesItem>
                       <telerik:ChartSeriesItem Name="Item 2" YValue="2">
                       </telerik:ChartSeriesItem>
                   </Items>
               </telerik:ChartSeries>
               <telerik:ChartSeries Name="Series 2" Type="StackedBar">
                   <Appearance>
                       <LabelAppearance Visible="False">
                       </LabelAppearance>
                   </Appearance>
                   <Items>
                       <telerik:ChartSeriesItem Name="Item 1" YValue="3">
                       </telerik:ChartSeriesItem>
                       <telerik:ChartSeriesItem Name="Item 2" YValue="1">
                       </telerik:ChartSeriesItem>
                   </Items>
               </telerik:ChartSeries>
               <telerik:ChartSeries DefaultLabelValue="#STSUM" Name="Series 3"
                   Type="StackedBar">
                   <Items>
                       <telerik:ChartSeriesItem Name="Item 1" YValue="4">
                       </telerik:ChartSeriesItem>
                       <telerik:ChartSeriesItem Name="Item 2" YValue="5">
                       </telerik:ChartSeriesItem>
                   </Items>
               </telerik:ChartSeries>
           </Series>
       </telerik:RadChart>

You can find more details about the available tokens in this help topic.

Kind regards,
Ves
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
Paul Smith
Top achievements
Rank 1
answered on 05 Apr 2010, 11:30 PM
Thank you! Much appreciated.
0
Travis
Top achievements
Rank 1
answered on 02 May 2011, 04:45 PM
What would be the syntax for this if you were binding to a database?
0
Ves
Telerik team
answered on 05 May 2011, 11:29 AM
Hi Travis,

The syntax would be the same. However, when databinding, it is possible that you have no ChartSeries before the databinding occurs. In this case, you can wire the DataBound event of RadChart and update the ChartSeries there.

Best regards,
Ves
the Telerik team

Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

0
Travis
Top achievements
Rank 1
answered on 05 May 2011, 02:59 PM
Thank you.  That would expalin my problem.  I ended up using the tooltip control and setting #STSUM on the ItemDataBound event of the chart.
Tags
Chart (Obsolete)
Asked by
Paul Smith
Top achievements
Rank 1
Answers by
Ves
Telerik team
Paul Smith
Top achievements
Rank 1
Travis
Top achievements
Rank 1
Share this question
or