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

ScatterLineSeries Code Behind

3 Answers 233 Views
ChartView
This is a migrated thread and some comments may be shown as answers.
James
Top achievements
Rank 1
James asked on 03 Feb 2015, 12:01 PM
Hi,

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

Sort by
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.

 
0
James
Top achievements
Rank 1
answered on 06 Feb 2015, 10:09 AM
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.

 
Tags
ChartView
Asked by
James
Top achievements
Rank 1
Answers by
Milena
Telerik team
James
Top achievements
Rank 1
Share this question
or