##// END OF EJS Templates
Updates access to y-axis properties of the data series (1)...
Alexandre Leroux -
r1030:99f1718ec669
parent child
Show More
@@ -193,6 +193,9 public:
193 193 /// @sa IDataSeries::xAxisUnit()
194 194 Unit xAxisUnit() const override { return m_XAxisUnit; }
195 195
196 /// @sa IDataSeries::yAxisUnit()
197 Unit yAxisUnit() const override { return m_YAxis.unit(); }
198
196 199 /// @return the values dataset
197 200 std::shared_ptr<ArrayData<Dim> > valuesData() { return m_ValuesData; }
198 201 const std::shared_ptr<ArrayData<Dim> > valuesData() const { return m_ValuesData; }
@@ -202,6 +205,8 public:
202 205
203 206 int nbPoints() const override { return m_ValuesData->totalSize(); }
204 207
208 std::pair<double, double> yBounds() const override { return m_YAxis.bounds(); }
209
205 210 void clear()
206 211 {
207 212 m_XAxisData->clear();
@@ -384,8 +389,8 public:
384 389 }
385 390
386 391 /// @return the y-axis associated to the data series
387 /// @todo pass getter as protected and use iterators to access the y-axis data
388 OptionalAxis yAxis() const { return m_YAxis; }
392 const OptionalAxis &yAxis() const { return m_YAxis; }
393 OptionalAxis &yAxis() { return m_YAxis; }
389 394
390 395 // /////// //
391 396 // Mutexes //
@@ -39,6 +39,9 public:
39 39
40 40 virtual Unit xAxisUnit() const = 0;
41 41
42 /// @return the y-axis unit, if axis is defined, default unit otherwise
43 virtual Unit yAxisUnit() const = 0;
44
42 45 virtual Unit valuesUnit() const = 0;
43 46
44 47 virtual void merge(IDataSeries *dataSeries) = 0;
@@ -53,6 +56,9 public:
53 56 /// @return the total number of points contained in the data series
54 57 virtual int nbPoints() const = 0;
55 58
59 /// @return the bounds of the y-axis axis (if defined)
60 virtual std::pair<double, double> yBounds() const = 0;
61
56 62 // ///////// //
57 63 // Iterators //
58 64 // ///////// //
@@ -101,8 +101,7 struct AxisSetter<T, typename std::enable_if_t<std::is_base_of<SpectrogramSeries
101 101 {
102 102 dataSeries.lockRead();
103 103 auto xAxisUnit = dataSeries.xAxisUnit();
104 /// @todo ALX: use iterators here
105 auto yAxisUnit = dataSeries.yAxis().unit();
104 auto yAxisUnit = dataSeries.yAxisUnit();
106 105 auto valuesUnit = dataSeries.valuesUnit();
107 106 dataSeries.unlock();
108 107
@@ -180,8 +180,7 struct PlottablesUpdater<T,
180 180 static void setPlotYAxisRange(T &dataSeries, const SqpRange &xAxisRange, QCustomPlot &plot)
181 181 {
182 182 double min, max;
183 /// @todo ALX: use iterators here
184 std::tie(min, max) = dataSeries.yAxis().bounds();
183 std::tie(min, max) = dataSeries.yBounds();
185 184
186 185 if (!std::isnan(min) && !std::isnan(max)) {
187 186 plot.yAxis->setRange(QCPRange{min, max});
General Comments 0
You need to be logged in to leave comments. Login now