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

Method onChangeCurveColor

pj_plotting/widget/src/PlotWidget.cpp:777–792  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

775}
776
777void PlotWidget::onChangeCurveColor(const QString& curve_name, QColor new_color) {
778 CurveInfo* info = curveFromTitle(curve_name);
779 if (info != nullptr && info->curve != nullptr) {
780 info->curve->setPen(new_color, info->curve->pen().widthF());
781 // Remember the override so the curve keeps this color when re-dragged into
782 // another plot (issue #68). Keyed by source_name, the same key addCurve uses.
783 // Time-series only: XY curves are keyed by a composed title and the registry
784 // is never consulted for them (addCurveXY does not auto-assign from it), so
785 // writing them here would only add entries nothing reads.
786 if (CurveColorRegistry* registry = colorRegistryOf(session_); registry != nullptr && !isXYPlot()) {
787 registry->setColor(info->source_name, new_color.name());
788 }
789 emit curveColorChanged(info->source_name, new_color);
790 replot();
791 }
792}
793
794void PlotWidget::setCurveLineWidth(const QString& curve_name, double width) {
795 CurveInfo* info = curveFromTitle(curve_name);

Callers 2

onPickerColorChangedMethod · 0.80
TESTFunction · 0.80

Calls 5

colorRegistryOfFunction · 0.85
setPenMethod · 0.45
penMethod · 0.45
setColorMethod · 0.45
nameMethod · 0.45

Tested by 1

TESTFunction · 0.64