MCPcopy Create free account
hub / github.com/PlotJuggler/PlotJuggler / addCurve

Method addCurve

pj_plotting/widget/src/PlotWidgetBase.cpp:230–254  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

228}
229
230PlotWidgetBase::CurveInfo* PlotWidgetBase::addCurve(
231 const QString& name, QwtSeriesData<QPointF>* series, QColor color, const QString& display_name) {
232 if (series == nullptr || curveFromTitle(name) != nullptr) {
233 delete series;
234 return nullptr;
235 }
236
237 auto* curve = new QwtPlotCurve(display_name.isEmpty() ? name : display_name);
238 curve->setPaintAttribute(QwtPlotCurve::ClipPolygons, true);
239 curve->setPaintAttribute(QwtPlotCurve::FilterPointsAggressive, true);
240 curve->setData(series);
241 curve->setPen(color == Qt::transparent ? nextColor() : color);
242 setStyle(curve, curveStyle());
243 curve->setRenderHint(QwtPlotItem::RenderAntialiased, true);
244 curve->attach(qwtPlot());
245
246 auto* marker = new QwtPlotMarker;
247 marker->attach(qwtPlot());
248 marker->setVisible(false);
249 marker->setSymbol(new QwtSymbol(QwtSymbol::Ellipse, Qt::red, QPen(Qt::black), QSize(8, 8)));
250
251 plot_->curve_list.push_back(CurveInfo{.source_name = name, .curve = curve, .marker = marker});
252 emit curveListChanged();
253 return &plot_->curve_list.back();
254}
255
256void PlotWidgetBase::removeCurve(const QString& title) {
257 auto it = std::find_if(plot_->curve_list.begin(), plot_->curve_list.end(), [&title](const CurveInfo& info) {

Callers

nothing calls this directly

Calls 10

QPenClass · 0.50
QSizeClass · 0.50
isEmptyMethod · 0.45
setPaintAttributeMethod · 0.45
setDataMethod · 0.45
setPenMethod · 0.45
setRenderHintMethod · 0.45
attachMethod · 0.45
setVisibleMethod · 0.45
setSymbolMethod · 0.45

Tested by

no test coverage detected