Hi I would like to create a tool that let me calculate the distance between to point. But I have not idea how to do it, I already create a Graph plotting point.
Thanks for your help
Hi I would like to create a tool that let me calculate the distance between to point. But I have not idea how to do it, I already create a Graph plotting point.
Thanks for your help
Finally I was able to resolve the issue, using the QCPItemLine class. I create a function that paints the arrow, and this is called by MouseEvent. Below I leave the code:
QCPItemLine *arrow = new QCPItemLine(ui->customPlot);
double x1 = ui->customPlot->xAxis->pixelToCoord(FirstPoint.x());
double y1 = ui->customPlot->yAxis->pixelToCoord(FirstPoint.y());
double x2 = ui->customPlot->xAxis->pixelToCoord(LastPoint.x());
double y2 = ui->customPlot->yAxis->pixelToCoord(LastPoint.y());
arrow->start->setCoords(x1,y1);
arrow->end->setCoords(x2,y2); // point to (4, 1.6) in x-y-plot coordinates
arrow->setHead(QCPLineEnding::esSpikeArrow);
Good Luck!