I have RadCartesianChart with 10 CategoricalDataPoints. How can i set color for each CategoricalDataPoint programmatically?
1 Answer, 1 is accepted
0
Martin Ivanov
Telerik team
answered on 15 Dec 2014, 01:06 PM
Hello Igor,
Let me start with a short explanation on that how the chart's data points are visualized. Most chart series (except the line series) have a default visual elements that represents its data points. This element can be replaced through the PointTemplate of the series, which means that there is no guarantee that the point will be always visualized with the series' default visual.
The color of the data points cannot be set through the (Categorical)DataPoint model. One of the reasons is that if there is a custom PointTemplate the model won't know what property this elements use for setting its color and if there is such property.
To customize the color of the data points you can define a DefaultVisualStyle (or PointTemplate) and bind a Brush property from your view model to the color property of the visual element.
Where the DataItem is a property of the DataPoint object that holds a reference to the view model behind the point. You can take a look at the Customizing CatesianChart Series help article to see how to define DefaultVisualStyle or PointTemplate.
I would also ask you to keep the communication about a particular issue or requirement in a single thread. This way we will be able to organize our communication history better and assist you in the most suitable manner for your case.
Regards,
Martin
Telerik
Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.