Simple stacked bar example

7 posts, 0 answers
  1. ebaker
    ebaker avatar
    4 posts
    Member since:
    Jan 2010

    Posted 23 Sep 2010 Link to this post

    Can someone please give me a simple example on how  to make a horizontal stacked bar chart? I'm finding it very difficult to grasp the charting controls, and I'm under a tight deadline at the moment. I just need a single horizontal bar (not 3D) with 3 stacks colored green, red, and gray. I can get 3 separate bars to display, but I can't stack them into a single bar. What am I missing? If someone can throw together a few lines of code to show me an example, that would be very helpful.

    Thanks,
    Eric
  2. Evgenia
    Admin
    Evgenia avatar
    1406 posts

    Posted 27 Sep 2010 Link to this post

    Hi Eric,

    This is a sample of Horizontal Stacked Bar made of three Series as you requested.

    <my:RadChart x:Name="radChart1">
               <my:RadChart.DefaultView>
                   <Charting:ChartDefaultView>
                       <Charting:ChartDefaultView.ChartArea>
                           <Charting:ChartArea>
                               <Charting:ChartArea.DataSeries>
                                   <!-- Series 1 -->
                                   <Charting:DataSeries LegendLabel="Series 1">
                                       <Charting:DataSeries.Definition>
                                           <Charting:HorizontalStackedBarSeriesDefinition>
                                           </Charting:HorizontalStackedBarSeriesDefinition>
                                       </Charting:DataSeries.Definition>
                                       <Charting:DataPoint YValue="20"/>
                                   </Charting:DataSeries>
                                   <!-- Series 2 -->
                                   <Charting:DataSeries LegendLabel="Series 2">
                                       <Charting:DataSeries.Definition>
                                           <Charting:HorizontalStackedBarSeriesDefinition>
                                           </Charting:HorizontalStackedBarSeriesDefinition>
                                       </Charting:DataSeries.Definition>
                                       <Charting:DataPoint YValue="10"/>
                                   </Charting:DataSeries>
                                   <!-- Series 3 -->
                                   <Charting:DataSeries LegendLabel="Series 3">
                                       <Charting:DataSeries.Definition>
                                           <Charting:HorizontalStackedBarSeriesDefinition>
                                           </Charting:HorizontalStackedBarSeriesDefinition>
                                       </Charting:DataSeries.Definition>
                                       <Charting:DataPoint YValue="40"/>
                                   </Charting:DataSeries>
                               </Charting:ChartArea.DataSeries>
                           </Charting:ChartArea>
                       </Charting:ChartDefaultView.ChartArea>
                   </Charting:ChartDefaultView>
               </my:RadChart.DefaultView>
           </my:RadChart>
     
    Additionally you can set custom color for each Series as shown in this help topic - http://www.telerik.com/help/silverlight/radchart-styling-and-appearance-styling-chart-series.html

    Hope this helps.

    Best wishes,
    Evgenia
    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
  3. DevCraft banner
  4. ebaker
    ebaker avatar
    4 posts
    Member since:
    Jan 2010

    Posted 27 Sep 2010 Link to this post

    Thanks! That was exactly what I needed.

    Eric
  5. Abhishek
    Abhishek avatar
    3 posts
    Member since:
    Aug 2011

    Posted 23 Aug 2011 Link to this post

    Hi,
    I have some other problems. I have to place 4 checkboxes on the chart as I have 4 series in a single stack bar. Now when i want to do filtering through the check boxes, as depending on the boxes to be checked the graph would show only those serieses.

    Please give me some idea.

    Thank you.
  6. Evgenia
    Admin
    Evgenia avatar
    1406 posts

    Posted 26 Aug 2011 Link to this post

    Hi Abhishek,

    Take a look at our demo with source code that will help you achieve your scenario.

    Kind regards,
    Evgenia
    the Telerik team

    Thank you for being the most amazing .NET community! Your unfailing support is what helps us charge forward! We'd appreciate your vote for Telerik in this year's DevProConnections Awards. We are competing in mind-blowing 20 categories and every vote counts! VOTE for Telerik NOW >>

  7. Ammar
    Ammar avatar
    1 posts
    Member since:
    Feb 2014

    Posted 11 Aug 2015 in reply to Evgenia Link to this post

    What is namespace "my:" is referring to ? ,in the example you posted.
  8. Evgenia
    Admin
    Evgenia avatar
    1406 posts

    Posted 12 Aug 2015 Link to this post

    Hello Eric,

    I was not able to find the namespace you mentioned in the source code of the demo. Are we looking at one and the same online example? I would be helpful if you could send us a code snippet where this namespace is used.

    Let me know if you need a runnable version of one of our online demos and we'll provide it.

    Regards,
    Evgenia
    Telerik
    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 Feedback Portal and vote to affect the priority of the items
Back to Top
DevCraft banner