##// END OF EJS Templates
Handles rendering of plottables (3)...
Alexandre Leroux -
r919:6c44d229ea1f
parent child
Show More
@@ -23,6 +23,10 public:
23 /// Sets properties of the plot's axes from the data series passed as parameter
23 /// Sets properties of the plot's axes from the data series passed as parameter
24 void setAxesProperties(std::shared_ptr<IDataSeries> dataSeries) noexcept;
24 void setAxesProperties(std::shared_ptr<IDataSeries> dataSeries) noexcept;
25
25
26 /// Sets rendering properties of the plottables passed as parameter, from the data series that
27 /// generated these
28 void setPlottablesProperties(std::shared_ptr<IDataSeries> dataSeries,
29 PlottablesMap &plottables) noexcept;
26
30
27 /// Shows or hides graph overlay (name, close button, etc.)
31 /// Shows or hides graph overlay (name, close button, etc.)
28 void showGraphOverlay(bool show) noexcept;
32 void showGraphOverlay(bool show) noexcept;
@@ -1,5 +1,6
1 #include "Visualization/VisualizationGraphRenderingDelegate.h"
1 #include "Visualization/VisualizationGraphRenderingDelegate.h"
2 #include "Visualization/AxisRenderingUtils.h"
2 #include "Visualization/AxisRenderingUtils.h"
3 #include "Visualization/PlottablesRenderingUtils.h"
3 #include "Visualization/VisualizationGraphWidget.h"
4 #include "Visualization/VisualizationGraphWidget.h"
4 #include "Visualization/qcustomplot.h"
5 #include "Visualization/qcustomplot.h"
5
6
@@ -227,6 +228,13 void VisualizationGraphRenderingDelegate::setAxesProperties(
227 impl->m_Plot.layer(AXES_LAYER)->replot();
228 impl->m_Plot.layer(AXES_LAYER)->replot();
228 }
229 }
229
230
231 void VisualizationGraphRenderingDelegate::setPlottablesProperties(
232 std::shared_ptr<IDataSeries> dataSeries, PlottablesMap &plottables) noexcept
233 {
234 auto plottablesHelper = IPlottablesHelperFactory::create(dataSeries);
235 plottablesHelper->setProperties(plottables);
236 }
237
230 void VisualizationGraphRenderingDelegate::showGraphOverlay(bool show) noexcept
238 void VisualizationGraphRenderingDelegate::showGraphOverlay(bool show) noexcept
231 {
239 {
232 auto overlay = impl->m_Plot.layer(OVERLAY_LAYER);
240 auto overlay = impl->m_Plot.layer(OVERLAY_LAYER);
@@ -118,6 +118,11 void VisualizationGraphWidget::addVariable(std::shared_ptr<Variable> variable, S
118 if (auto dataSeries = variable->dataSeries()) {
118 if (auto dataSeries = variable->dataSeries()) {
119 // Set axes properties according to the units of the data series
119 // Set axes properties according to the units of the data series
120 impl->m_RenderingDelegate->setAxesProperties(dataSeries);
120 impl->m_RenderingDelegate->setAxesProperties(dataSeries);
121
122 // Sets rendering properties for the new plottables
123 // Warning: this method must be called after setAxesProperties(), as it can access to some
124 // axes properties that have to be initialized
125 impl->m_RenderingDelegate->setPlottablesProperties(dataSeries, createdPlottables);
121 }
126 }
122
127
123 impl->m_VariableToPlotMultiMap.insert({variable, std::move(createdPlottables)});
128 impl->m_VariableToPlotMultiMap.insert({variable, std::move(createdPlottables)});
General Comments 0
You need to be logged in to leave comments. Login now