Event for clicking a point in diagram #260
-
Hi, Is there any way to select a point in LiveCharts2? I can see that there is an event for 'PointHovered' but not clicked. Is there any way to solve this in another way (or a workaround)? |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 5 replies
-
I too have been struggling with this. In the previous version there were events Chart.DataClick & Chart.DataHover. Would be nice to see this feature return. |
Beta Was this translation helpful? Give feedback.
-
But I would also prefer an event handler. As a workaround I am using the MouseDoubleClick event handler:
XAML code behind:
|
Beta Was this translation helpful? Give feedback.
-
Any luck with the code for making a cross hair at the mouse location? I would like to implement it on multiple charts without having to code a mouse event for each chart, maybe a method they can share but not sure how to display the cross hair on the chart without drawing segment lines manually. Would be nice if the next update included this as an option/feature of the charting object itself. |
Beta Was this translation helpful? Give feedback.
-
After digging through the sources I realised that there is DataPointerDown event on the Series classes. The core of the code I now have working is shown in the snippets below. In your viewmodel define your series
In your VM's constructor hook up the event handler and add the series into your ObservableCollectio
The event handler looks like this.
In my case I use this approach to keep the selected row in a DataGrid in sync with the selected data point on the chart. |
Beta Was this translation helpful? Give feedback.
I too have been struggling with this.
In the previous version there were events Chart.DataClick & Chart.DataHover.
Would be nice to see this feature return.