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

Create a dinamically chart

1 Answer 50 Views
Chart
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Thiago
Top achievements
Rank 1
Thiago asked on 17 May 2012, 06:06 PM
Hello!
I need to create a dinamically chart, by the code-behind. 
I´ll receive a DataSet, and it´ll be plotted based on these informations.
I´m creating a bar chart , so it´s necessary to set the data template from each item.
My doubt is: How can I do this? A option is use predefined data template at page´s resource.
I´ve read about the PointTemplateSelector, but I don´t know how can I manipulate it.

Best wishes,

Thiago



1 Answer, 1 is accepted

Sort by
0
Victor
Telerik team
answered on 18 May 2012, 10:25 AM
Hi Thiago,

 Thanks for the question.
Please have a look at our online help for RadChart. It contains a lot of information about basic chart usage.
This particular article should be interesting since it contains an example of how to use a template selector. The template selector here is used to select label templates however, the usage pattern is very similar for the point template selector.

In short, the point template selector should be a class that inherits from DataTemplateSelector and overrides the SelectTemplate method. Since the point template selector is a class that you need to develop, you can put any properties that your like on it and you can give it references to any DataTemplate that you need. Then, when the SelectTemplate method is called by RadChart, you will return the correct data template based on the information that the chart provides in SelectTemplate's method arguments.

Please write again if you have other questions.

Kind regards,
Victor
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

Tags
Chart
Asked by
Thiago
Top achievements
Rank 1
Answers by
Victor
Telerik team
Share this question
or