QCustomPlot Discussion and Comments

vertical line addingReturn to overview

Please clarify how can i add a vertical line to graphics in Version: 2.0.1 ?

If you want to add an infinite line, use :

QCPItemStraightLine *infLine = new QCPItemStraightLine(customPlot);
infLine->point1->setCoords(2, 0);  // location of point 1 in plot coordinate
infLine->point2->setCoords(2, 1);  // location of point 2 in plot coordinate

If you want a finite line, use :

QCPItemLine *line = new QCPItemLine(customPlot);
line->point1->setCoords(2, 0);  // location of point 1 in plot coordinate
line->point2->setCoords(2, 1);  // location of point 2 in plot coordinate

Vincent