##// END OF EJS Templates
Handles rendering of plottables (2)...
Alexandre Leroux -
r919:f75604dde9e3
parent child
Show More
@@ -1,5 +1,7
1 1 #include "Visualization/PlottablesRenderingUtils.h"
2 2
3 #include <Common/ColorUtils.h>
4
3 5 #include <Data/ScalarSeries.h>
4 6 #include <Data/VectorSeries.h>
5 7
@@ -28,7 +30,19 struct PlottablesSetter<T, typename std::enable_if_t<std::is_base_of<ScalarSerie
28 30 or std::is_base_of<VectorSeries, T>::value> > {
29 31 static void setProperties(T &dataSeries, PlottablesMap &plottables)
30 32 {
31 /// @todo ALX
33 // Gets the number of components of the data series
34 dataSeries.lockRead();
35 auto componentCount = dataSeries.valuesData()->componentCount();
36 dataSeries.unlock();
37
38 // Generates colors for each component
39 auto colors = ColorUtils::colors(Qt::blue, Qt::red, componentCount);
40
41 // For each component of the data series, creates a QCPGraph to add to the plot
42 for (auto i = 0; i < componentCount; ++i) {
43 auto graph = plottables.at(i);
44 graph->setPen(QPen{colors.at(i)});
45 }
32 46 }
33 47 };
34 48
@@ -1,8 +1,6
1 1 #include "Visualization/VisualizationGraphHelper.h"
2 2 #include "Visualization/qcustomplot.h"
3 3
4 #include <Common/ColorUtils.h>
5
6 4 #include <Data/ScalarSeries.h>
7 5 #include <Data/SpectrogramSeries.h>
8 6 #include <Data/VectorSeries.h>
@@ -52,13 +50,9 struct PlottablesCreator<T,
52 50 auto componentCount = dataSeries.valuesData()->componentCount();
53 51 dataSeries.unlock();
54 52
55 auto colors = ColorUtils::colors(Qt::blue, Qt::red, componentCount);
56
57 53 // For each component of the data series, creates a QCPGraph to add to the plot
58 54 for (auto i = 0; i < componentCount; ++i) {
59 55 auto graph = plot.addGraph();
60 graph->setPen(QPen{colors.at(i)});
61
62 56 result.insert({i, graph});
63 57 }
64 58
General Comments 0
You need to be logged in to leave comments. Login now