File tree Expand file tree Collapse file tree 1 file changed +16
-4
lines changed Expand file tree Collapse file tree 1 file changed +16
-4
lines changed Original file line number Diff line number Diff line change @@ -66,9 +66,18 @@ def refresh(self):
66
66
self ._resolution = 0
67
67
68
68
self ._plot .setData (item .x , y )
69
- if y_slave is not None and len (y_slave ) > 0 :
69
+ # The following code looks awkward but it is by far
70
+ # the best solution. The user could choose to deactivate
71
+ # the master-slave mode and keep the slave data there.
72
+ # In this case, a legend is still required. Therefore,
73
+ # we cannot toggle the legend by the signal from the
74
+ # master-slave checkbox in the GUI.
75
+ if y_slave is not None :
70
76
self ._plot_slave .setData (item .x_slave , y_slave )
71
- self .showLegend ()
77
+ if len (y_slave ) > 0 :
78
+ self .showLegend ()
79
+ else :
80
+ self .hideLegend ()
72
81
else :
73
82
self .hideLegend ()
74
83
else :
@@ -84,11 +93,14 @@ def refresh(self):
84
93
self ._resolution = resolution
85
94
86
95
self ._plot .setData (item .x , y .avg , y_min = y .min , y_max = y .max )
87
- if y_slave is not None and len ( y_slave . avg ) > 0 :
96
+ if y_slave is not None :
88
97
self ._plot_slave .setData (
89
98
item .x_slave , y_slave .avg ,
90
99
y_min = y_slave .min , y_max = y_slave .max )
91
- self .showLegend ()
100
+ if len (y_slave .avg ) > 0 :
101
+ self .showLegend ()
102
+ else :
103
+ self .hideLegend ()
92
104
else :
93
105
self .hideLegend ()
94
106
You can’t perform that action at this time.
0 commit comments