##// END OF EJS Templates
onRangeChanged is now based on the good range (the new one)...
perrinel -
r315:076efd0d6728
parent child
Show More
@@ -53,7 +53,7 private slots:
53 /// Slot called when right clicking on the graph (displays a menu)
53 /// Slot called when right clicking on the graph (displays a menu)
54 void onGraphMenuRequested(const QPoint &pos) noexcept;
54 void onGraphMenuRequested(const QPoint &pos) noexcept;
55
55
56 void onRangeChanged(const QCPRange &t1, const QCPRange &t2);
56 void onRangeChanged(const QCPRange &t1);
57
57
58 /// Slot called when a mouse wheel was made, to perform some processing before the zoom is done
58 /// Slot called when a mouse wheel was made, to perform some processing before the zoom is done
59 void onMouseWheel(QWheelEvent *event) noexcept;
59 void onMouseWheel(QWheelEvent *event) noexcept;
@@ -59,10 +59,15 void updateScalarData(QCPAbstractPlottable *component, ScalarSeries &scalarSerie
59 xValue.resize(n);
59 xValue.resize(n);
60 vValue.resize(n);
60 vValue.resize(n);
61
61
62 qCInfo(LOG_VisualizationGraphHelper()) << "TORM: Current points displayed"
62 qCInfo(LOG_VisualizationGraphHelper()) << "TORM: Current points displayed" << xValue.count()
63 << xValue.count();
63 << dateTime;
64
64
65 qcpGraph->setData(xValue, vValue);
65 qcpGraph->setData(xValue, vValue);
66
67 // Display all data
68 // component->parentPlot()->xAxis->setRange(dateTime.m_TStart, dateTime.m_TEnd);
69 component->rescaleAxes();
70 component->parentPlot()->replot();
66 }
71 }
67 else {
72 else {
68 /// @todo DEBUG
73 /// @todo DEBUG
@@ -97,7 +102,6 QCPAbstractPlottable *createScalarSeriesComponent(ScalarSeries &scalarSeries, QC
97
102
98 // Display all data
103 // Display all data
99 component->rescaleAxes();
104 component->rescaleAxes();
100
101 plot.replot();
105 plot.replot();
102 }
106 }
103 else {
107 else {
@@ -49,9 +49,9 VisualizationGraphWidget::VisualizationGraphWidget(const QString &name, QWidget
49 ui->widget->setInteractions(QCP::iRangeDrag | QCP::iRangeZoom);
49 ui->widget->setInteractions(QCP::iRangeDrag | QCP::iRangeZoom);
50 ui->widget->axisRect()->setRangeDrag(Qt::Horizontal);
50 ui->widget->axisRect()->setRangeDrag(Qt::Horizontal);
51 connect(ui->widget, &QCustomPlot::mouseWheel, this, &VisualizationGraphWidget::onMouseWheel);
51 connect(ui->widget, &QCustomPlot::mouseWheel, this, &VisualizationGraphWidget::onMouseWheel);
52 connect(ui->widget->xAxis, static_cast<void (QCPAxis::*)(const QCPRange &, const QCPRange &)>(
52 connect(ui->widget->xAxis,
53 &QCPAxis::rangeChanged),
53 static_cast<void (QCPAxis::*)(const QCPRange &)>(&QCPAxis::rangeChanged), this,
54 this, &VisualizationGraphWidget::onRangeChanged);
54 &VisualizationGraphWidget::onRangeChanged);
55
55
56 // Activates menu when right clicking on the graph
56 // Activates menu when right clicking on the graph
57 ui->widget->setContextMenuPolicy(Qt::CustomContextMenu);
57 ui->widget->setContextMenuPolicy(Qt::CustomContextMenu);
@@ -168,18 +168,19 void VisualizationGraphWidget::onGraphMenuRequested(const QPoint &pos) noexcept
168 }
168 }
169 }
169 }
170
170
171 void VisualizationGraphWidget::onRangeChanged(const QCPRange &t1, const QCPRange &t2)
171 void VisualizationGraphWidget::onRangeChanged(const QCPRange &t1)
172 {
172 {
173
173
174 qCDebug(LOG_VisualizationGraphWidget()) << tr("VisualizationGraphWidget::onRangeChanged");
174 qCInfo(LOG_VisualizationGraphWidget()) << tr("VisualizationGraphWidget::onRangeChanged");
175
175
176 for (auto it = impl->m_VariableToPlotMultiMap.cbegin();
176 for (auto it = impl->m_VariableToPlotMultiMap.cbegin();
177 it != impl->m_VariableToPlotMultiMap.cend(); ++it) {
177 it != impl->m_VariableToPlotMultiMap.cend(); ++it) {
178
178
179 auto variable = it->first;
179 auto variable = it->first;
180 auto dateTime = SqpDateTime{t2.lower, t2.upper};
180 auto dateTime = SqpDateTime{t1.lower, t1.upper};
181
181
182 if (!variable->contains(dateTime)) {
182 if (!variable->contains(dateTime)) {
183 qCInfo(LOG_VisualizationGraphWidget()) << dateTime << variable->dateTime();
183
184
184 auto variableDateTimeWithTolerance = dateTime;
185 auto variableDateTimeWithTolerance = dateTime;
185 if (variable->intersect(dateTime)) {
186 if (variable->intersect(dateTime)) {
General Comments 0
You need to be logged in to leave comments. Login now