! Sets the QCPGraph this tracer sticks to. The tracer \a position will be set to type QCPItemPosition::ptPlotCoords and the axes will be set to the axes of \a graph. To free the tracer from any graph, set \a graph to \c nullptr. The tracer \a position can then be placed freely like any other item position. This is the state the tracer will assume when its graph gets deleted while stil
| 30529 | \see setGraphKey |
| 30530 | */ |
| 30531 | void QCPItemTracer::setGraph(QCPGraph *graph) |
| 30532 | { |
| 30533 | if (graph) |
| 30534 | { |
| 30535 | if (graph->parentPlot() == mParentPlot) |
| 30536 | { |
| 30537 | position->setType(QCPItemPosition::ptPlotCoords); |
| 30538 | position->setAxes(graph->keyAxis(), graph->valueAxis()); |
| 30539 | mGraph = graph; |
| 30540 | updatePosition(); |
| 30541 | } else |
| 30542 | qDebug() << Q_FUNC_INFO << "graph isn't in same QCustomPlot instance as this item"; |
| 30543 | } else |
| 30544 | { |
| 30545 | mGraph = nullptr; |
| 30546 | } |
| 30547 | } |
| 30548 | |
| 30549 | /*! |
| 30550 | Sets the key of the graph's data point the tracer will be positioned at. This is the only free |