QCustomPlot Discussion and Comments

Display coordinates of nearest point to the cursor on the curveReturn to overview

I need to display the coordinates of the nearest point on the graph whenever the cursor hovers in the graph section. I've read posts (old posts) but some functions are missing in the new library. Like ```lowerBound``` that is not found in the version of QCustomPlot that I use...

Hi,

I use following code to get the nearest point on the x-axis.

QCPGraphDataContainer::const_iterator leftIt = _pPlot->graph(0)->data()->findBegin(coordinate);

Full code here: https://github.com/jgeudens/ModbusScope/blob/c21db6b812679642a04372332261dc024d7003b1/src/graphview/graphview.cpp#L593

Thank you for your reply it helped me a lot, but this is only for x value and I also need the y value