Thanks,
John
7 Answers, 1 is accepted
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.
Thanks for the reply. I don't see the sample project attachment. Please attach it.
Thanks,
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.
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
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.
Regards,
Martin
Telerik by Progress
Hi Martin,
That worked like a charm. Thanks a lot!
Cheers,
Artem