QCustomPlot Discussion and Comments

Drawing a uniform line over multiple QCPAxisRectReturn to overview

I have created a QCustomPlot line graphs containing multiple QCPAxisRect which share a common margin (makes them aligned) and aligned vertically.

I have a requirement that I need to draw a vertical line across all the line graphs (i.e. the axis rects) when the mouse hovers hover any one of them i.e. a vertical line will move horizontally based on the mouse's x-position. I have overriden the mouseMoveEvent for QCustomPlot and looping through all the QAxisRect and adding a QItemLine with appropriate x,y position. Now, the problem is that I only get the line for the first axis rect, not on any subsequent graphs. How do I make it appear on top of all the rects and not just the first one?

Also, I have to show the a axis value beside the line as a text label. For this, how do I get the x-axis value from x-coordinate ?

i think you can just use the position type "ptViewportRatio instead of ptAxisRectRatio or ptPlotCoords". getting the axis value is pretty easy, you just take the coordinate you got from mouse move and pass it into the QCPAxis function that converts to plot coordinates (pixelToCoord).

hello ,can u please send me the code
thanks in advance