##// END OF EJS Templates
Handles rendering of plottables (2)...
Alexandre Leroux -
r918:f75604dde9e3
parent child
Show More
@@ -1,5 +1,7
1 #include "Visualization/PlottablesRenderingUtils.h"
1 #include "Visualization/PlottablesRenderingUtils.h"
2
2
3 #include <Common/ColorUtils.h>
4
3 #include <Data/ScalarSeries.h>
5 #include <Data/ScalarSeries.h>
4 #include <Data/VectorSeries.h>
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 or std::is_base_of<VectorSeries, T>::value> > {
30 or std::is_base_of<VectorSeries, T>::value> > {
29 static void setProperties(T &dataSeries, PlottablesMap &plottables)
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 #include "Visualization/VisualizationGraphHelper.h"
1 #include "Visualization/VisualizationGraphHelper.h"
2 #include "Visualization/qcustomplot.h"
2 #include "Visualization/qcustomplot.h"
3
3
4 #include <Common/ColorUtils.h>
5
6 #include <Data/ScalarSeries.h>
4 #include <Data/ScalarSeries.h>
7 #include <Data/SpectrogramSeries.h>
5 #include <Data/SpectrogramSeries.h>
8 #include <Data/VectorSeries.h>
6 #include <Data/VectorSeries.h>
@@ -52,13 +50,9 struct PlottablesCreator<T,
52 auto componentCount = dataSeries.valuesData()->componentCount();
50 auto componentCount = dataSeries.valuesData()->componentCount();
53 dataSeries.unlock();
51 dataSeries.unlock();
54
52
55 auto colors = ColorUtils::colors(Qt::blue, Qt::red, componentCount);
56
57 // For each component of the data series, creates a QCPGraph to add to the plot
53 // For each component of the data series, creates a QCPGraph to add to the plot
58 for (auto i = 0; i < componentCount; ++i) {
54 for (auto i = 0; i < componentCount; ++i) {
59 auto graph = plot.addGraph();
55 auto graph = plot.addGraph();
60 graph->setPen(QPen{colors.at(i)});
61
62 result.insert({i, graph});
56 result.insert({i, graph});
63 }
57 }
64
58
General Comments 0
You need to be logged in to leave comments. Login now