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

SelectionChanged not working for ScatterLine

1 Answer 119 Views
ChartView
This is a migrated thread and some comments may be shown as answers.
Kevin
Top achievements
Rank 1
Kevin asked on 13 Feb 2015, 03:41 PM
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">




1 Answer, 1 is accepted

Sort by
0
Accepted
Martin Ivanov
Telerik team
answered on 16 Feb 2015, 03:08 PM
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.

 
Tags
ChartView
Asked by
Kevin
Top achievements
Rank 1
Answers by
Martin Ivanov
Telerik team
Share this question
or