QCustomPlot Discussion and Comments

Draw line relative to yaxis2Return to overview

I can draw a line using QCPItemLine, but I'd like to specify the Y start and end coordinates relative to yaxis2. Is there a simple way to do this? Right now, I'm calculating the equivalent yaxis values which works but seems ugly.

Answering my own question, setAxes does it:

QCPItemLine *line = new QCPItemLine(customPlot);
line->start->setAxes(customPlot->xAxis,customPlot->yAxis2);
line->start->setType(QCPItemPosition::ptPlotCoords);

and similar for the line end