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

[Solved] CartesianChart Dynamic Series Collection of View Models

4 Answers 215 Views
Chart for XAML
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Olivier
Top achievements
Rank 1
Olivier asked on 11 Mar 2013, 10:09 AM

I want to generate Dynamic Series for the CartesianChart control with collection of View Models but I don't know how to do that.

 

The documnetation says:

 

Support the following data resolution:

 

1 - Collection of collections – e.g. List of Arrays.

 

2 - Collection of view models, where each model contains a property, containing the data for the series.

 

http://www.telerik.com/help/windows-8-xaml/radchart-cartesianchart-series-dynamicseries-overview.html
 

Collection of collections is working fine but how to manage collection of view Models. Does someone have a little example? Like the one for Collection of collections: 

http://www.telerik.com/help/windows-8-xaml/radchart-cartesianchart-series-categorical-dynamicseries-howtocreatebarchartdynamicseries.html
 

Thanks

 

Olivier

4 Answers, 1 is accepted

Sort by
0
Accepted
Ivaylo Gergov
Telerik team
answered on 13 Mar 2013, 05:37 PM
Hello Olivier,

Thank you for using our RadControls for Windows 8!

For your convenience I have prepared a project using the described approach. Please, find the attached file. As you can see in this example in order to bind the CategoricalSeriesDescriptor to the property of the current ViewModel I am using the CategoricalSeriesDescriptor.ItemsSourcePath property.

I hope this helps. Let me know if you need further assistance.

 

Greetings,
Ivaylo Gergov
the Telerik team
Have a suggestion or face a problem - you can use the Ideas & Feedback portal to submit ideas, feedback and vote for them.
0
Olivier
Top achievements
Rank 1
answered on 14 Mar 2013, 06:13 PM
Hi Ivaylo,

Yes, your project  help me a lot.
Today, I put real data in the View Models and the graph is updated every second. Now, I can add  as many lines I want at runtime!
I didn't know about
CategoricalSeriesDescriptor.ItemsSourcePath 

Many Thanks
 

Olivier


0
Dev
Top achievements
Rank 1
answered on 13 Mar 2014, 10:07 AM
Hi,

Thanks for the post.

I am able to generate dynamic series for cartesianchart.
I am generating 2 to 4 area series dynamically but these are showing default colors.

Could you please help me how to control the background color of dynamically generated Area series?
0
Ivaylo Gergov
Telerik team
answered on 17 Mar 2014, 11:51 AM
Hi,

In this case you have three options. If you want to change the default color of the dynamically generated AreaSeries you can do it in the CategoricalSeriesDescriptor.Style as in the example from our online documentation : http://www.telerik.com/help/windows-8-xaml/radchart-cartesianchart-series-dynamicseries-usingviewmodelscollection.html. The second option allows you to change their color after the series have been drawn. Here's an example:
(this.chart.Series[0] as AreaSeries).Fill = new SolidColorBrush(Colors.Pink);

The third option is to apply a custom color for each series(before they have been generated) based on some internal logic. In this case you can create a custom series descriptor and apply the color for each series. 

For you convenience I have attached a sample project that shows the three scenarios. 

Please feel free to contact us if you have any questions.

Regards,
Ivaylo Gergov
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.

 
Tags
Chart for XAML
Asked by
Olivier
Top achievements
Rank 1
Answers by
Ivaylo Gergov
Telerik team
Olivier
Top achievements
Rank 1
Dev
Top achievements
Rank 1
Share this question
or