Stacked Bar 100% Example

2 posts, 1 answers
  1. Barnes
    Barnes avatar
    17 posts
    Member since:
    May 2012

    Posted 23 Nov 2012 Link to this post

    I am trying to create a stacked 100% bar chart using the RadChart but cannot get it to work. I need to have up to two separate bars for each category for the chart. Please see attached file for an example of the chart that I wish to display. I have seen a screenshot from your website suggesting that it is possible (also attached).

    The custom object that I am using contains two dimensions (categories) and two measures (values). The data that I have will look something like the following:

     Category 1

    Category 2 

    Value 1 

    Value 2 

    A

    Grade 1

    60

    40

    A

    Grade 2

    81

    19

    B

    Grade 1

    83

    17

    B

    Grade 2

    85

    15

    C

    Grade 1

    84

    16

     

    Please can you let me know if this is even possible and give some explanation how if it is possible.

    Thanks in advance,

    Barnes

  2. Answer
    Missing user
    Missing user avatar

    Posted 26 Nov 2012 Link to this post

    Hi Thomas,

    This type of scenario is a bit tricky and can't be done in XAML alone. Because you can have up to two separate bars for each chart category, this makes Category2 dynamic - you can have a single value (Grade 1) or several (Grade 1 and Grade 2; possibly even more if your specifications change later on).

    Therefore, you need to create the series mappings dynamically. You'll have to  group the source collection of custom objects by their Category2 values and then create the SeriesMappings, all of which must be done procedurally. I've attached a sample project based on the data you've provided.

    Let me know if you need further assistance.

    Regards,
    Ivan N.
    the Telerik team

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

  3. DevCraft banner
Back to Top