ScatterLineSeries Code Behind

4 posts, 0 answers
  1. James
    James avatar
    22 posts
    Member since:
    Mar 2013

    Posted 03 Feb 2015 Link to this post

    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,
  2. Milena
    Admin
    Milena avatar
    201 posts

    Posted 04 Feb 2015 Link to this post

    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.

     
  3. UI for WPF is Visual Studio 2017 Ready
  4. James
    James avatar
    22 posts
    Member since:
    Mar 2013

    Posted 06 Feb 2015 in reply to Milena Link to this post

    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?
  5. Milena
    Admin
    Milena avatar
    201 posts

    Posted 09 Feb 2015 Link to this post

    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.

     
Back to Top