I'm creating a RadCartesianChart with a ScatterLineSeries from the code behind. I was hoping to have each datapoint in a series represented by a random shape (like a triangle). Is this possible? I can't work out how to do it.
Thanks,
3 Answers, 1 is accepted
0
Milena
Telerik team
answered on 04 Feb 2015, 01:13 PM
Hi James,
It is possible to set different shape and color for each point in ScatterLineSeries. You can take a look at our help topic Customizing Scatter Points where you can see a sample implementation of setting custom shapes for the Scatter points via DataTemplate and PointTemplateSelector.
I hope this will get you started.
Regards,
Milena
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.
OK thanks, so I can't just "turn it on" (i.e. ShowDataPointShapes = True) I have to individually specify the data point shape for each series?
0
Milena
Telerik team
answered on 09 Feb 2015, 09:42 AM
Hi James,
It depends on your scenario. If you need to have a different PointTemplate for each series, then you can set the PointTemplate property of the series. You can also use DataTemplateSelector (as in the article) and add a custom logic setting the different Point Templates when a certain criteria is satisfied:
public override DataTemplate SelectTemplate(object item, DependencyObject container)
{
...
if (dataPoint.YValue > 105)
{
return chart.Resources["ellipseTemplate"] as DataTemplate;
}
else
{
return chart.Resources["rectangleTemplate"] as DataTemplate;
}
}
I hope this information will help you and don't hesitate to write back if you have more questions.
Regards,
Milena
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.