##// END OF EJS Templates
Separate the initialization of the properties of the graph of the update of the units of the graph....
Alexandre Leroux -
r1254:41b7c6aab8be
parent child
Show More
@@ -9,6 +9,7 class IDataSeries;
9 class QCustomPlot;
9 class QCustomPlot;
10 class QMouseEvent;
10 class QMouseEvent;
11 class Unit;
11 class Unit;
12 class Variable;
12 class VisualizationGraphWidget;
13 class VisualizationGraphWidget;
13
14
14 class VisualizationGraphRenderingDelegate {
15 class VisualizationGraphRenderingDelegate {
@@ -23,13 +24,14 public:
23 /// Updates rendering when data of plot changed
24 /// Updates rendering when data of plot changed
24 void onPlotUpdated() noexcept;
25 void onPlotUpdated() noexcept;
25
26
26 /// Sets properties of the plot's axes from the data series passed as parameter
27 /// Sets units of the plot's axes according to the properties of the variable passed as
27 void setAxesProperties(std::shared_ptr<IDataSeries> dataSeries) noexcept;
28 /// parameter
29 void setAxesUnits(const Variable &variable) noexcept;
28
30
29 /// Sets rendering properties of the plottables passed as parameter, from the data series that
31 /// Sets graph properties of the plottables passed as parameter, from the variable that
30 /// generated these
32 /// generated these
31 void setPlottablesProperties(std::shared_ptr<IDataSeries> dataSeries,
33 void setGraphProperties(const Variable &variable, PlottablesMap &plottables) noexcept;
32 PlottablesMap &plottables) noexcept;
34
33
35
34 /// Shows or hides graph overlay (name, close button, etc.)
36 /// Shows or hides graph overlay (name, close button, etc.)
35 void showGraphOverlay(bool show) noexcept;
37 void showGraphOverlay(bool show) noexcept;
@@ -9,6 +9,7
9 #include <Common/DateUtils.h>
9 #include <Common/DateUtils.h>
10
10
11 #include <Data/IDataSeries.h>
11 #include <Data/IDataSeries.h>
12 #include <Variable/Variable.h>
12
13
13 #include <SqpApplication.h>
14 #include <SqpApplication.h>
14
15
@@ -302,14 +303,14 void VisualizationGraphRenderingDelegate::onPlotUpdated() noexcept
302 impl->m_Plot.replot();
303 impl->m_Plot.replot();
303 }
304 }
304
305
305 void VisualizationGraphRenderingDelegate::setAxesProperties(
306 void VisualizationGraphRenderingDelegate::setAxesUnits(const Variable &variable) noexcept
306 std::shared_ptr<IDataSeries> dataSeries) noexcept
307 {
307 {
308 // Stores x-axis label to be able to retrieve it when x-axis pixmap is unselected
309 impl->m_XAxisLabel = dataSeries->xAxisUnit().m_Name;
310
308
311 auto axisHelper = IAxisHelperFactory::create(dataSeries);
309 auto axisHelper = IAxisHelperFactory::create(variable);
312 axisHelper->setProperties(impl->m_Plot, impl->m_ColorScale);
310 axisHelper->setUnits(impl->m_Plot, impl->m_ColorScale);
311
312 // Stores x-axis label to be able to retrieve it when x-axis pixmap is unselected
313 impl->m_XAxisLabel = impl->m_Plot.xAxis->label();
313
314
314 // Updates x-axis state
315 // Updates x-axis state
315 impl->updateXAxisState();
316 impl->updateXAxisState();
@@ -317,10 +318,15 void VisualizationGraphRenderingDelegate::setAxesProperties(
317 impl->m_Plot.layer(AXES_LAYER)->replot();
318 impl->m_Plot.layer(AXES_LAYER)->replot();
318 }
319 }
319
320
320 void VisualizationGraphRenderingDelegate::setPlottablesProperties(
321 void VisualizationGraphRenderingDelegate::setGraphProperties(const Variable &variable,
321 std::shared_ptr<IDataSeries> dataSeries, PlottablesMap &plottables) noexcept
322 PlottablesMap &plottables) noexcept
322 {
323 {
323 auto plottablesHelper = IPlottablesHelperFactory::create(dataSeries);
324 // Axes' properties
325 auto axisHelper = IAxisHelperFactory::create(variable);
326 axisHelper->setProperties(impl->m_Plot, impl->m_ColorScale);
327
328 // Plottables' properties
329 auto plottablesHelper = IPlottablesHelperFactory::create(variable);
324 plottablesHelper->setProperties(plottables);
330 plottablesHelper->setProperties(plottables);
325 }
331 }
326
332
General Comments 0
You need to be logged in to leave comments. Login now