Is it possible to display the value of a QLineSeries point in a QChart?
-
Hello, I would like to create a chart where the user is able to read to value of every point of a chart by passing the mouse over it.
I found this piece of code that I tried to modify: https://stackoverflow.com/a/41346349 but the problem is that it shows the value where the mouse stands whenever it is inside the chart, whereas I would like it to only show the value of a point in the line series attached to the chart.I don't know if this is possible. I have the impression that the chart becomes an image and it is not possible to retreat information of the line series points.
Considering there is only one line series in a chart, I thought about finding the value in the chart pointed by the mouse with QChart::mapToValue and use the x value to find the closest line series point in the horizontal axe within (let's say) 3 pixels. The problem is that I haven't found a QChart function that returns that. One option would be to retrieve the entire line series with QChart::series and search for it, but if the series is too long (like hundred-of-items long) it may become difficult to show the value in real time.
Anyone has any ideas?