SelectionChanged not working for ScatterLine

2 posts, 1 answers
  1. Kevin
    Kevin avatar
    6 posts
    Member since:
    Oct 2014

    Posted 13 Feb 2015 Link to this post

    Hello Support,

         <telerik:RadCartesianChart.Behaviors>
                <telerik:ChartTrackBallBehavior ShowIntersectionPoints="True" TrackInfoUpdated="ChartTrackBallBehavior_TrackInfoUpdated" />
                <telerik:ChartSelectionBehavior DataPointSelectionMode="Single" SelectionChanged="RadChart1_SelectionChanged" />
             </telerik:RadCartesianChart.Behaviors>


    <!-- This code does not work, when i click on all of the points on the line, i never have the event triggered  -->
             <telerik:ScatterLineSeries ItemsSource="{Binding LineProfileDataValues}"
                                      YValueBinding="RedBandOrMonoValue" XValueBinding="PixelNumber" Stroke="Red" Width=".5" TrackBallTemplate="{StaticResource trackBallTemplateR}" IsHitTestVisible="True">


    <!-- If i simple change from a LineSeries to a ScatterPointSeries, then the event is triggered and everything works correctly  -->
             <telerik:ScatterPointSeries ItemsSource="{Binding LineProfileDataValues}"
                                      YValueBinding="RedBandOrMonoValue" XValueBinding="PixelNumber" TrackBallTemplate="{StaticResource trackBallTemplateR}" IsHitTestVisible="True">




  2. Answer
    Martin
    Admin
    Martin avatar
    1099 posts

    Posted 16 Feb 2015 Link to this post

    Hi Kevin,

    Most of the Cartesian chart's series have a default visual that represents their data points. For example, a Border element for the bar series and a Path for the point series. You can modify this visual element through the DefaultVisualStyle property of the series. You can also replace this default visual with custom element through the series' PoinTemplate property. However, the line series (like the LineSeries and ScatterLineSeries) does not have such visual, or in other words there is no element that physically represents the data point.

    On the other hand the SelectionBehavior works with the data point's visual element to select the data point. The ScatterLineSeries does not have a visual and this is why the SelectionChanged event is never called. To resolve this you can define a PointTemplate for the ScatterLineSeries.

    Here is an example:
    <telerik:ScatterLineSeries>
        <telerik:ScatterLineSeries.PointTemplate>
            <DataTemplate>
                <Ellipse Fill="Red" Width="15" Height="15" />
            </DataTemplate>
        </telerik:ScatterLineSeries.PointTemplate>
    </telerik:ScatterLineSeries>

    Please try this and let me know if it works for you.

    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.

     
  3. UI for WPF is Visual Studio 2017 Ready
Back to Top