QCustomPlot Discussion and Comments

Draw Line and move itReturn to overview

http://imgur.com/RU8KkZR
Hi, what would be the way to draw a line like this on picture, when i click on circle, i need to be able to move it, and so it move line. For line i use QCPItemLine, then i tried QCPItemTracer, and moving tracer but it does not move line.

    tr1 = new QCPItemTracer(customPlot);
    customPlot->addItem(tr1);
    tr1->setInterpolating(true);
    tr1->setStyle(QCPItemTracer::tsCircle);
    tr1->setPen(QPen(Qt::red));
    tr1->setBrush(Qt::red);
    tr1->setSize(7);
    tr1->position->setAxes(xAxis, yAxis2);
    tr1->position->setTypeX(QCPItemPosition::ptViewportRatio);
    tr1->position->setTypeY(QCPItemPosition::ptPlotCoords);
    tr1->position->setCoords(0.1f, yAxis2->pixelToCoord(mouseY));

    tr2 = new QCPItemTracer(customPlot);
    customPlot->addItem(tr2);
    tr2->setInterpolating(true);
    tr2->setStyle(QCPItemTracer::tsCircle);
    tr2->setPen(QPen(Qt::red));
    tr2->setBrush(Qt::red);
    tr2->setSize(12);
    tr2->position->setAxes(xAxis, yAxis2);
    tr2->position->setTypeX(QCPItemPosition::ptViewportRatio);
    tr2->position->setTypeY(QCPItemPosition::ptPlotCoords);
    tr2->position->setCoords(0.9f, yAxis2->pixelToCoord(mouseY));

    QCPItemLine *tLine = new QCPItemLine(customPlot);
    customPlot->addItem(tLine);

    tLine->setObjectName("QCPItemTrendLine");
    tLine->setLayer("legend");
    tLine->setClipToAxisRect(true);
    tLine->setSelectable(false);
    tLine->start->setAxes(xAxis, yAxis2);
    tLine->end->setAxes(xAxis, yAxis2);
    tLine->start->setTypeX(QCPItemPosition::ptViewportRatio);
    tLine->start->setTypeY(QCPItemPosition::ptPlotCoords);
    tLine->end->setTypeX(QCPItemPosition::ptViewportRatio);
    tLine->end->setTypeY(QCPItemPosition::ptPlotCoords);
    tLine->setPen(QPen(QColor(0, 255, 0, 255)));
    tLine->setLineVisible(true);
    
    tLine->start->setParentAnchor(tr1->position, false);
    tLine->end->setParentAnchor(tr2->position, false);

I got 5errors
1.tr1 not declared in this scope
2.tr2 not declared in this scope
3.xAxis not declared in this scope
4.yAxis2 not declared in this scope
5.mouseY not declared in this scope..
please help me to solve those above mentioned errors