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

Generic RadChart Multicategory

3 Answers 64 Views
Chart
This is a migrated thread and some comments may be shown as answers.
Alan
Top achievements
Rank 1
Alan asked on 26 Nov 2013, 01:41 AM
I'm trying to create a user control with RadChart and an expandable RadGridView underneath capable of attaching to any data source.  That is, I can attach the entire control to any DataTable source, without knowing anything about the source (columns, datatypes, etc.) until runtime. 

The chart provides metrics, while the grid underneath exposes the underlying data to the user, allowing them to sort and filter what is displayed on the chart.  To that end, I'm binding both the grid and the chart to a QueryableCollectionView, which has been working well enough.

My problem is that all of my data is categorical and that combinations of columns could potentially produce a category.  That is, I may have two fields providing categories, such as "Year" and "FirstName", and then one field providing Y Values, such as "Distance".  In this example I would want my X categories to be "2010 - James", "2011 - James", "2010 - Mark", etc. or some combination of those fields.  In theory, I could make a calculated column in my data source with this formatting, for the label, but the problem is more complex...

Ideally, I also want to give the user control over these groupings.  I understand how to give my series various aggregation functions for the values, and RadChart seems to handle the values just fine.  But if a user selects a grouping on "Year" in the above example, I would want the chart to instead display "2010", "2011" with series values calculated according to the grouping function.  If I had a calculated column underneath my data, I would need to update this expression according to what fields the user had selected to group on.

So: Is that calculated column the only approach to this or is there something a little less complicated for handling multi-category data?

A couple notes:
  • The chart itself does not seem to natively support multi-category axes, since if I create two ItemMappings both with DataPointMember.XCategory, RadChart will only use the last one.  If this is an option, that would be great.
  • Could I use RadGridView's grouping panel to do the grouping?  I may have something set up incorrectly but even if I provide grouping functions for the GridView, when I group the GridView, the Chart displays a single series of data points with 0 as the YValue.

3 Answers, 1 is accepted

Sort by
0
Yavor
Telerik team
answered on 28 Nov 2013, 11:27 AM
Hi Alan,

First I want to suggest using RadChartView(represented by the classes RadCartesianChart,RadPieChartandRadPolarChart).
instead of RadChart.

The RadChartView is the newer control which addresses some of the limitations and deficiencies that we have identified in the RadChart implementation over the years. It is easier to set up and has vastly improved performance. For detailed comparison between the two controls, check this help topic.

The RadChart and the RadChartView are visualization controls. They need some configuration in order to show graphs. It is up to you to provide data in proper format and to configure them properly. You can think of charts as some kind of ItemsControls. I suggest that you create a view model in which you can extract the data, combine the fields and create business objects. Then bind the collection of business objects to your chart and configure it to display a line, bar, pie, etc.

For starters you can check our samples here and our online documentation here.

Hope this information helps!

Regards,
Yavor
Telerik
TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WPF.
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>
0
Alan
Top achievements
Rank 1
answered on 18 Dec 2013, 09:30 PM
I've since switched over to ChartView and I think it's working better.  For my project, it would be nice to have the animations provided by the older chart, but I do see other help topics on how to get that working in the new control.

For the record/others looking, I recently stumbled upon a better example of what I was trying to achieve when I say "Multi-Category" (see the pictures):
http://www.telerik.com/community/forums/wpf/charting-kit/clustered-bar-chart---dual-x-axis-labels-is-this-possible.aspx

What I've ended up doing is using a broker between my datasource and the chart viewmodel that generates the datapoints with a built string representing the category. 

It would be very cool, however, if ChartView had the above functionality built-in by using some sort of collection of CategoryValue paths.  That is, for a set of objects with Cat1, Cat2, and Value, I could set up the CategoricalSeriesDescriptor with two CategoryPaths (one each to Cat1 and Cat2), that would look like the picture in the linked forum topic.

Thanks for the help!
0
Peshito
Telerik team
answered on 21 Dec 2013, 09:59 AM
Hello Alan,

Thank you for your detailed feedback on this matter. We actually have a feature request logged in our feedback portal regarding this kind of functionality. You can vote for it in order to raise its priority using this link.

Regards,
Peshito
Telerik
TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WPF.
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>
Tags
Chart
Asked by
Alan
Top achievements
Rank 1
Answers by
Yavor
Telerik team
Alan
Top achievements
Rank 1
Peshito
Telerik team
Share this question
or