##// 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 9 class QCustomPlot;
10 10 class QMouseEvent;
11 11 class Unit;
12 class Variable;
12 13 class VisualizationGraphWidget;
13 14
14 15 class VisualizationGraphRenderingDelegate {
@@ -23,13 +24,14 public:
23 24 /// Updates rendering when data of plot changed
24 25 void onPlotUpdated() noexcept;
25 26
26 /// Sets properties of the plot's axes from the data series passed as parameter
27 void setAxesProperties(std::shared_ptr<IDataSeries> dataSeries) noexcept;
27 /// Sets units of the plot's axes according to the properties of the variable passed as
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 32 /// generated these
31 void setPlottablesProperties(std::shared_ptr<IDataSeries> dataSeries,
32 PlottablesMap &plottables) noexcept;
33 void setGraphProperties(const Variable &variable, PlottablesMap &plottables) noexcept;
34
33 35
34 36 /// Shows or hides graph overlay (name, close button, etc.)
35 37 void showGraphOverlay(bool show) noexcept;
@@ -9,6 +9,7
9 9 #include <Common/DateUtils.h>
10 10
11 11 #include <Data/IDataSeries.h>
12 #include <Variable/Variable.h>
12 13
13 14 #include <SqpApplication.h>
14 15
@@ -302,14 +303,14 void VisualizationGraphRenderingDelegate::onPlotUpdated() noexcept
302 303 impl->m_Plot.replot();
303 304 }
304 305
305 void VisualizationGraphRenderingDelegate::setAxesProperties(
306 std::shared_ptr<IDataSeries> dataSeries) noexcept
306 void VisualizationGraphRenderingDelegate::setAxesUnits(const Variable &variable) 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);
312 axisHelper->setProperties(impl->m_Plot, impl->m_ColorScale);
309 auto axisHelper = IAxisHelperFactory::create(variable);
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 315 // Updates x-axis state
315 316 impl->updateXAxisState();
@@ -317,10 +318,15 void VisualizationGraphRenderingDelegate::setAxesProperties(
317 318 impl->m_Plot.layer(AXES_LAYER)->replot();
318 319 }
319 320
320 void VisualizationGraphRenderingDelegate::setPlottablesProperties(
321 std::shared_ptr<IDataSeries> dataSeries, PlottablesMap &plottables) noexcept
321 void VisualizationGraphRenderingDelegate::setGraphProperties(const Variable &variable,
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 330 plottablesHelper->setProperties(plottables);
325 331 }
326 332
General Comments 0
You need to be logged in to leave comments. Login now