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

using RadCartesianChart for stacked grouped bars

7 Answers 214 Views
ChartView
This is a migrated thread and some comments may be shown as answers.
John
Top achievements
Rank 1
John asked on 04 Mar 2014, 09:47 PM
I am using RadCartesianChart to display stacked grouped bar chart shown in the attachment. I searched forums to get an idea and also looked at the demo source code, but I am not able to get it to work. I am using MVVM. Please show me a sample project using MVVM that will be able to do this.

Thanks,
John

7 Answers, 1 is accepted

Sort by
0
john
Top achievements
Rank 1
answered on 05 Mar 2014, 05:20 PM
Attached the picture
0
Martin Ivanov
Telerik team
answered on 07 Mar 2014, 05:00 PM
Hi John,

You can achieve your requirement by using the CombineMode Stack along with the StackGroupKey property. The StackGroupKey property sets the key that defines in which stack group a series will be included.

For your convenience I attached a sample project which demonstrates creating of clustered and stacked BarSeries. Note that the series in the project are created dynamically with the RadCartesianChart.SeriesProvider. Another thing you can keep in mind is that when you use the SeriesDescriptor you need to define a style for the ChartSeries. In the sample project the StackGroupKey is set through an attached property to a property from the business object. This is needed because of the fact the StackGroupKey property was not designed as a dependency property.

Regards,
Martin
Telerik

DevCraft Q1'14 is here! Watch the online conference to see how this release solves your top-5 .NET challenges. Watch on demand now.

0
john
Top achievements
Rank 1
answered on 07 Mar 2014, 05:33 PM
Hi martin,

Thanks for the reply. I don't see the sample project attachment. Please attach it.

Thanks,
John
0
Martin Ivanov
Telerik team
answered on 11 Mar 2014, 05:27 PM
Hello John,

I apologize for the inconvenience caused. I reattached the project and now you should be able to see it.

Regards,
Martin
Telerik

DevCraft Q1'14 is here! Watch the online conference to see how this release solves your top-5 .NET challenges. Watch on demand now.

0
Artem
Top achievements
Rank 1
answered on 30 Sep 2016, 06:20 AM

Hi,

I'm trying to implement exactly same thing in silverlight (sigh!) and it works except palette part. Ideally I'd like to have a separate palette for each series group, but it would do if each series would use different colour (like in your example). In my case though the colour is applied on group basis, i.e. my left and right bars are in different colours but I don't see stacked items. Is there a way to achieve this? Tried to search but found nothing...

Thank you,

Artem

0
Martin Ivanov
Telerik team
answered on 30 Sep 2016, 12:53 PM
Hi Artem,

The palette of the chart operates per series (or per data point for some series). Coloring per group is not supported out of the box. To achieve your requirement you can use the DefaultVisualStyle of the series. There are couple approaches that I can suggest you:
  • Define a color/brush property in the view model of the data points and bind it to the background of the default visual. Based on the group of the data point, set its color.
  • Bind the background of the default visual with an IValueConverter and based on a property (lets say the index in the group) from the view model set a different color. 
Check the attached project.

Regards,
Martin
Telerik by Progress
Do you need help with upgrading your AJAX, WPF or WinForms project? Check the Telerik API Analyzer and share your thoughts.
0
Artem
Top achievements
Rank 1
answered on 03 Oct 2016, 11:39 PM

Hi Martin,

That worked like a charm. Thanks a lot!

Cheers,

Artem

Tags
ChartView
Asked by
John
Top achievements
Rank 1
Answers by
john
Top achievements
Rank 1
Martin Ivanov
Telerik team
Artem
Top achievements
Rank 1
Share this question
or