show trace names for traces which are only on secondary Y axis

This commit is contained in:
Jan Käberich 2025-05-18 13:36:44 +02:00
parent 8a56b36166
commit fde6707c9c

View file

@ -1040,8 +1040,14 @@ void TraceXYPlot::enableTraceAxis(Trace *t, int axis, bool enabled)
// unable to add trace to the requested axis // unable to add trace to the requested axis
return; return;
} }
if(axis == 0) { if(enabled) {
TracePlot::enableTrace(t, enabled); TracePlot::enableTrace(t, true);
} else {
// only disable trace on parent trace list if disabled for both axes
int otherAxis = axis ? 0 : 1;
if(tracesAxis[otherAxis].find(t) == tracesAxis[otherAxis].end()) {
TracePlot::enableTrace(t, false);
}
} }
bool alreadyEnabled = tracesAxis[axis].find(t) != tracesAxis[axis].end(); bool alreadyEnabled = tracesAxis[axis].find(t) != tracesAxis[axis].end();
if(alreadyEnabled != enabled) { if(alreadyEnabled != enabled) {