##// END OF EJS Templates
Show tracers method (2)...
Alexandre Leroux -
r484:a4b9eba8c160
parent child
Show More
@@ -50,6 +50,14 void VisualizationGraphRenderingDelegate::onMouseMove(QMouseEvent *event) noexce
50
50
51 auto showTracers = [ eventPos = event->pos(), this ]()
51 auto showTracers = [ eventPos = event->pos(), this ]()
52 {
52 {
53 // Lambda function to display a tracer
54 auto displayTracer = [this](auto &tracer) {
55 // Tracer is set on top of the plot's main layer
56 tracer.setLayer(impl->m_Plot.layer("main"));
57 tracer.setVisible(true);
58 impl->m_Plot.replot();
59 };
60
53 // Reinits tracers
61 // Reinits tracers
54 impl->m_PointTracer->setGraph(nullptr);
62 impl->m_PointTracer->setGraph(nullptr);
55 impl->m_PointTracer->setVisible(false);
63 impl->m_PointTracer->setVisible(false);
@@ -67,6 +75,19 void VisualizationGraphRenderingDelegate::onMouseMove(QMouseEvent *event) noexce
67 auto key = formatValue(graphDataIt->key, *graph->keyAxis());
75 auto key = formatValue(graphDataIt->key, *graph->keyAxis());
68 auto value = formatValue(graphDataIt->value, *graph->valueAxis());
76 auto value = formatValue(graphDataIt->value, *graph->valueAxis());
69 impl->m_TextTracer->setText(TEXT_TRACER_FORMAT.arg(key, value));
77 impl->m_TextTracer->setText(TEXT_TRACER_FORMAT.arg(key, value));
78
79 // Displays point tracer
80 impl->m_PointTracer->setGraph(graph);
81 impl->m_PointTracer->setGraphKey(mouseKey);
82 displayTracer(*impl->m_PointTracer);
83
84 // Displays text tracer
85 auto tracerPosition = impl->m_TextTracer->position;
86 tracerPosition->setAxes(graph->keyAxis(), graph->valueAxis());
87 tracerPosition->setCoords(impl->m_PointTracer->position->key(),
88 impl->m_PointTracer->position->value());
89 displayTracer(*impl->m_TextTracer);
90 }
70 }
91 }
71 };
92 };
72
93
General Comments 0
You need to be logged in to leave comments. Login now