Find Data Value with Mouse on a QtChart
-
Hey everyone,
Hope all is well. Currently, I have been working on an app that uses QtCharts and QChartView. No issues thus far with most of the features I am trying to implement, as I have been able to find documentation or have been helped by this wonderful community. However, I do have one question, as I've hit a roadblock.
Currently, I am trying to implement a feature in which the mouse can hover (and possibly even click) on individual data points to get data readings. Something akin to how the Google Stock Price Charts work:
As the gif above shows, I'd like to have some sort of feature where it displays the data point in relation to the x-location of the mouse.
What would I need to do to start this? I tried using a mouseMoveEvent function but the app crashed; that is the only thing I've tried so far. Thank you, in advance, for your time and consideration!
-
@MrShawn said in Find Data Value with Mouse on a QtChart:
hovered
So would I need to do something like this?
connect(seriesName, QXYSeries::hovered, chartName, displayPlotValueFunction);
Or would I need to try something else? Confused about the last parameter. Or, am I overcomplicating things? Thank you for your response!
-
@WesLow said in Find Data Value with Mouse on a QtChart:
Confused about the last parameter
Last parameter is the pointer to slot:
connect(seriesName, &QXYSeries::hovered, yourClassInstancePointer, &YourClassName::displayPlotValueFunction);