Auto status change to "Under Review"
@@ -158,10 +158,13 QVariant VariableModel::data(const QModelIndex &index, int role) const | |||
|
158 | 158 | /// that contains the time value to display |
|
159 | 159 | auto dateTimeVariant = [variable](const auto &getValueFun) { |
|
160 | 160 | if (auto dataSeries = variable->dataSeries()) { |
|
161 | dataSeries->lockRead(); | |
|
161 | 162 | auto it = getValueFun(*dataSeries); |
|
162 |
|
|
|
163 | auto resVariant = (it != dataSeries->cend()) | |
|
163 | 164 | ? DateUtils::dateTime(it->x()).toString(DATETIME_FORMAT) |
|
164 | 165 | : QVariant{}; |
|
166 | dataSeries->unlock(); | |
|
167 | return resVariant; | |
|
165 | 168 | } |
|
166 | 169 | else { |
|
167 | 170 | return QVariant{}; |
@@ -38,7 +38,7 QSharedPointer<QCPAxisTicker> axisTicker(bool isTimeAxis) | |||
|
38 | 38 | } |
|
39 | 39 | } |
|
40 | 40 | |
|
41 | /// Sets axes properties according to the properties of a data series | |
|
41 | /// Sets axes properties according to the properties of a data series. Not thread safe | |
|
42 | 42 | template <int Dim> |
|
43 | 43 | void setAxesProperties(const DataSeries<Dim> &dataSeries, QCustomPlot &plot) noexcept |
|
44 | 44 | { |
@@ -85,7 +85,9 struct PlottablesCreator<T, | |||
|
85 | 85 | PlottablesMap result{}; |
|
86 | 86 | |
|
87 | 87 | // Gets the number of components of the data series |
|
88 | dataSeries.lockRead(); | |
|
88 | 89 | auto componentCount = dataSeries.valuesData()->componentCount(); |
|
90 | dataSeries.unlock(); | |
|
89 | 91 | |
|
90 | 92 | auto colors = ColorUtils::colors(Qt::blue, Qt::red, componentCount); |
|
91 | 93 | |
@@ -98,7 +100,9 struct PlottablesCreator<T, | |||
|
98 | 100 | } |
|
99 | 101 | |
|
100 | 102 | // Axes properties |
|
103 | dataSeries.lockRead(); | |
|
101 | 104 | setAxesProperties(dataSeries, plot); |
|
105 | dataSeries.unlock(); | |
|
102 | 106 | |
|
103 | 107 | plot.replot(); |
|
104 | 108 | |
@@ -133,7 +137,6 struct PlottablesUpdater<T, | |||
|
133 | 137 | static void updatePlottables(T &dataSeries, PlottablesMap &plottables, const SqpRange &range, |
|
134 | 138 | bool rescaleAxes) |
|
135 | 139 | { |
|
136 | dataSeries.lockRead(); | |
|
137 | 140 | |
|
138 | 141 | // For each plottable to update, resets its data |
|
139 | 142 | std::map<int, QSharedPointer<SqpDataContainer> > dataContainers{}; |
@@ -145,6 +148,7 struct PlottablesUpdater<T, | |||
|
145 | 148 | dataContainers.insert({plottable.first, dataContainer}); |
|
146 | 149 | } |
|
147 | 150 | } |
|
151 | dataSeries.lockRead(); | |
|
148 | 152 | |
|
149 | 153 | // - Gets the data of the series included in the current range |
|
150 | 154 | // - Updates each plottable by adding, for each data item, a point that takes x-axis data |
@@ -192,7 +192,8 VisualizationGraphWidget *VisualizationZoneWidget::createGraph(std::shared_ptr<V | |||
|
192 | 192 | |
|
193 | 193 | // get y using variable range |
|
194 | 194 | if (auto dataSeries = variable->dataSeries()) { |
|
195 | auto valuesBounds = dataSeries->valuesBounds(range.m_TStart, range.m_TEnd); | |
|
195 | dataSeries->lockRead(); | |
|
196 | auto valuesBounds = dataSeries->valuesBounds(variable->range().m_TStart, variable->range().m_TEnd); | |
|
196 | 197 | auto end = dataSeries->cend(); |
|
197 | 198 | if (valuesBounds.first != end && valuesBounds.second != end) { |
|
198 | 199 | auto rangeValue = [](const auto &value) { return std::isnan(value) ? 0. : value; }; |
@@ -202,6 +203,7 VisualizationGraphWidget *VisualizationZoneWidget::createGraph(std::shared_ptr<V | |||
|
202 | 203 | |
|
203 | 204 | graphWidget->setYRange(SqpRange{minValue, maxValue}); |
|
204 | 205 | } |
|
206 | dataSeries->unlock(); | |
|
205 | 207 | } |
|
206 | 208 | |
|
207 | 209 | return graphWidget; |
@@ -18,7 +18,7 std::shared_ptr<IDataSeries> CosinusProvider::retrieveData(QUuid acqIdentifier, | |||
|
18 | 18 | auto dataIndex = 0; |
|
19 | 19 | |
|
20 | 20 | // Gets the timerange from the parameters |
|
21 |
double freq = 1 |
|
|
21 | double freq = 1.0; | |
|
22 | 22 | double start = std::ceil(dataRangeRequested.m_TStart * freq); // 100 htz |
|
23 | 23 | double end = std::floor(dataRangeRequested.m_TEnd * freq); // 100 htz |
|
24 | 24 |
General Comments 3
Status change > Approved
You need to be logged in to leave comments.
Login now