20 #include <qwt_interval_symbol.h>
21 #include <qwt_point_data.h>
28 auto boxLayout =
new QVBoxLayout(
this);
29 m_Plot =
new QwtPlot(QwtText(title),
this);
30 m_Plot->setCanvasBackground(Qt::white);
31 boxLayout->addWidget(
m_Plot);
47 m_Plot->insertLegend(legend, pos, ratio);
57 QwtText qwt_title = QwtText(title);
58 qwt_title.setColor(color);
59 qwt_title.setPaintAttribute(QwtText::PaintUsingTextColor);
61 QwtPlotCurve *curve =
new QwtPlotCurve(qwt_title);
62 QwtPlotIntervalCurve *xErrors =
new QwtPlotIntervalCurve();
63 QwtPlotIntervalCurve *yErrors =
new QwtPlotIntervalCurve();
65 auto tuple = std::make_tuple(curve, xErrors, yErrors);
73 std::get<1>(
m_PlotCurveVector.back())->setItemAttribute(QwtPlotItem::Legend,
false);
74 std::get<2>(
m_PlotCurveVector.back())->setItemAttribute(QwtPlotItem::Legend,
false);
81 this->
m_Plot->setTitle(qwt_title);
86 QwtText qwt_title_text(title);
92 m_Plot->setAxisTitle(axis, title);
99 if (xValues.size() != yValues.size())
101 std::cerr <<
"Sizes of data arrays don't match." << std::endl;
107 ->setSamples(
new QwtPointArrayData(rawDataX, rawDataY, static_cast<int>(xValues.size())));
120 success = success && this->
SetCurveData(curveId, xValues, yValues);
135 success = success && this->
SetCurveData(curveId, xValues, yValues);
147 ->setData(
new QwtPointArrayData(rawDataX, rawDataY, static_cast<int>(data.size())));
156 std::get<0>(
m_PlotCurveVector[curveId])->setLegendAttribute(QwtPlotCurve::LegendShowLine);
162 std::get<0>(
m_PlotCurveVector[curveId])->setLegendAttribute(QwtPlotCurve::LegendShowBrush);
178 std::get<0>(
m_PlotCurveVector[curveId])->setLegendAttribute(QwtPlotCurve::LegendShowSymbol);
183 std::get<0>(
m_PlotCurveVector[curveId])->setRenderHint(QwtPlotItem::RenderAntialiased);
188 std::get<0>(
m_PlotCurveVector[curveId])->setRenderHint(QwtPlotItem::RenderAntialiased,
false);
194 QwtIntervalSymbol *errorBar =
new QwtIntervalSymbol(QwtIntervalSymbol::Bar);
195 errorBar->setPen(pen);
198 errorBar =
new QwtIntervalSymbol(QwtIntervalSymbol::Bar);
199 errorBar->setPen(pen);
207 std::get<1>(
m_PlotCurveVector[curveId])->setStyle(QwtPlotIntervalCurve::NoCurve);
208 QwtIntervalSymbol *errorBar =
new QwtIntervalSymbol(QwtIntervalSymbol::Bar);
211 std::get<2>(
m_PlotCurveVector[curveId])->setStyle(QwtPlotIntervalCurve::NoCurve);
212 errorBar =
new QwtIntervalSymbol(QwtIntervalSymbol::Bar);
239 auto raw =
new double[values.size()];
240 for (
unsigned int i = 0; i < values.size(); ++i)
247 auto raw =
new double[values.size()];
248 for (
unsigned int i = 0; i < values.size(); ++i)
253 raw[i] = values[i].first;
256 raw[i] = values[i].second;
259 std::cout <<
"Component must be either 0 or 1." << std::endl;
270 const QwtSeriesData<QPointF> *curveSeriesData = std::get<0>(this->
m_PlotCurveVector[curveId])->data();
272 size_t size = curveSeriesData->size();
274 if (size != lessError.size() || size != moreError.size())
276 std::cerr <<
"Sizes of data arrays don't match." << std::endl;
280 QVector<QwtIntervalSample> samples;
281 QwtIntervalSample *sample;
282 QwtPlotIntervalCurve *curve;
293 for (
unsigned int index = 0; index < size; ++index)
295 qreal xValue = curveSeriesData->sample(index).x();
296 qreal yValue = curveSeriesData->sample(index).y();
299 sample =
new QwtIntervalSample(xValue, xValue - lessError[index], xValue + moreError[index]);
303 sample =
new QwtIntervalSample(xValue, yValue - lessError[index], yValue + moreError[index]);
305 samples.push_back(*sample);
308 curve->setSamples(samples);
309 curve->setStyle(QwtPlotIntervalCurve::NoCurve);
311 QwtIntervalSymbol *errorBar =
new QwtIntervalSymbol(QwtIntervalSymbol::Bar);
312 errorBar->setPen(QPen(Qt::black));
313 curve->setSymbol(errorBar);
317 curve->setOrientation(Qt::Horizontal);
321 curve->setOrientation(Qt::Vertical);