QCustomPlot Discussion and Comments

drawing outside axis rectReturn to overview

Hello in the documentation for position type http://www.qcustomplot.com/documentation/classQCPItemPosition.html#aad9936c22bf43e3d358552f6e86dbdc8 it states that for ptAxisRectRatio, you can go "beyond the rectangle axis by providing a negative coordinates or coordinates larger than 1. However, when I tried to draw a QCPItemLine, why is the line still within the rectangle axis?

Below is my code use to draw for the line

QCPItemLine *line = new QCPItemLine(customPlot);
line->setVisible(true);
line->setPen(QPen(Qt::red));
line->start->setTypeX(QCPItemPosition::ptAxisRectRatio);
line->end->setTypeY(QCPItemPosition::ptAxisRectRatio);
line->start->setCoords(.5,10000);
line->end->setCoords(.5,-10000);
customPlot->replot();

Read Item documentation:
http://www.qcustomplot.com/documentation/classQCPAbstractItem.html#details

the section about clipping. Or in the item tutorial: http://www.qcustomplot.com/index.php/tutorials/items at the bottom.

also i wouldnt use negative numbers in ptAxisRectRatio... i would use ptViewportRatio... which is intended for this use.

I fixed it, as Isso suggested, with line->setClipToAxisRect(false);, and as Ian suggested, I use ptViewportRation instead. Thank you.