##// END OF EJS Templates
Handles QCustomPlot plottables for vectors (1)...
Handles QCustomPlot plottables for vectors (1) - Uses a map that associate a component index to a plottable. - Replaces the current structure by the map in VisualizationGraphHelper For example: - for a scalar, there is a QCPGraph at index 0 - for a vector, there is three QCPGraph at indexes 0, 1 and 2

File last commit:

r561:df3e79308ca8
r581:098cadc4596c
Show More
ScalarSeries.cpp
31 lines | 1.1 KiB | text/x-c | CppLexer
#include <Data/ScalarSeries.h>
ScalarSeries::ScalarSeries(QVector<double> xAxisData, QVector<double> valuesData,
const Unit &xAxisUnit, const Unit &valuesUnit)
: DataSeries{std::make_shared<ArrayData<1> >(std::move(xAxisData)), xAxisUnit,
std::make_shared<ArrayData<1> >(std::move(valuesData)), valuesUnit}
{
}
std::unique_ptr<IDataSeries> ScalarSeries::clone() const
{
return std::make_unique<ScalarSeries>(*this);
}
std::shared_ptr<IDataSeries> ScalarSeries::subDataSeries(const SqpRange &range)
{
auto subXAxisData = QVector<double>();
auto subValuesData = QVector<double>();
this->lockRead();
{
auto bounds = subData(range.m_TStart, range.m_TEnd);
for (auto it = bounds.first; it != bounds.second; ++it) {
subXAxisData.append(it->x());
subValuesData.append(it->value());
}
}
this->unlock();
return std::make_shared<ScalarSeries>(subXAxisData, subValuesData, this->xAxisUnit(),
this->valuesUnit());
}