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

Stacked Bar 100% Example

1 Answer 99 Views
Chart
This is a migrated thread and some comments may be shown as answers.
Barnes
Top achievements
Rank 1
Barnes asked on 23 Nov 2012, 04:09 PM

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

1 Answer, 1 is accepted

Sort by
0
Accepted
Missing User
answered on 26 Nov 2012, 05:39 PM
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.

Tags
Chart
Asked by
Barnes
Top achievements
Rank 1
Answers by
Missing User
Share this question
or