What is a proper way to determine a 'selected'/'clicked' point in a series?
See original GitHub issueIn WPF, I am looking for a way to let the user click a point and allows editing the point in somewhere else or delete the target point.
So, I wish the series to expose an SelectedModel property to be bound to for the model the user clicked on, or allows a delegate to handle point clicking.
For example:
The closest thing that I found is PointHovered
:
series.PointHovered += SeriesPointHover;
private void SeriesPointHover(TypedChartPoint<DataPoint, LineBezierVisualPoint<SkiaSharpDrawingContext, CircleGeometry, CubicBezierSegment, SKPath>, LabelGeometry, SkiaSharpDrawingContext> point)
{
_logger.LogDebug("Hover point: {point}", point.Model);
if (point.Model is null)
{
return;
}
SelectedDataPoint.SetModel(point.Model);
}
That is not ideal because it is easy for it to hover over multiple points when they are close to each other.
It would be great if this could be done:
LineSeries<DataPoint> series = new LineSeries<DataPoint>()
{
Name = SelectedCategory.Id,
TooltipLabelFormatter = FormatToolTip,
Values = dataPoints,
Mapping = SeriesMapping,
ValueSelectedHandler = HandleSelectedDataPoint, // Add a delegate to process selected point
};
Otherwise, if there’s only 1 selected item, maybe make it a property to be bound on the chart?
Or maybe other ways to reach the goal?
Please help. Thanks!
Issue Analytics
- State:
- Created 2 years ago
- Comments:7 (3 by maintainers)
Top Results From Across the Web
Word Chapter 4 Practice Exam Flashcards
Use a single command on the Ribbon to show the gridlines for the table. You selected ., clicked the Layout ribbon tab. In...
Read more >CSE252 - Computer Vision - Assignment #2
arbitrarily selected (clicked) coordinate in the left image. Demonstrate that corresponding points in the right image lie on epipolar lines for at least ......
Read more >cannot get index of column selected/clicked in DT package ...
Does anyone know why this is happening? How can I get both the row and column index of a selection? And what about...
Read more >Calculation Sequence Checker
The Calculation Sequence Checker appears whenever the Calculation Designer is saved, and performs a check to confirm that any sequence numbers are in...
Read more >QAbstractItemView Class | Qt Widgets 6.5.2
This enum describes the different ways to navigate between items, ... QAbstractItemView::SelectedClicked, 4, Editing starts when clicking on an already ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
This need more documentation, I will keep an eye on this.
It is a group because there is always a chance that 2 or more points overlap in the plot, this was you could decide what to do with all the points that were clicked. also the event is fired according to the
CartesianChart.TooltipFindingStategy
property, this means that any point that is shown in the tooltip will be passed in this group to the event when the user clicks on the chart.But I think you are right there is something missing, most of the times we only need the closest point, so I added a new event, the
ChartPointPointerDown
will be called only with the closest point to the click.https://github.com/beto-rodriguez/LiveCharts2/blob/master/samples/ViewModelsSamples/Events/Cartesian/ViewModel.cs#L51
it is available since
beta-101
version.Hi @beto-rodriguez, thanks for responding 😃. We are developing a dll to allow us to use live charts (1 and now 2) within our win32 based app. As a result, I would need to send you a small executable within the repo that will be loaded (VS project) automatically. Would this be ok with you? You would simply need to start the repo in VS and it will load the exe and have a Live Chart displayed. Click on the point in the chart and I will breakpoint in the DLL code where I expect to have the point returned. Doing it this way would, selfishly, allow me to highlight some other issues I have experienced in other comments.
If this is NOT acceptable, it will take me some time to develop a UI for the developed DLL.