forked from M-Labs/artiq
1
0
Fork 0

plot_xy: refactor data_changed

This commit is contained in:
Simon Renblad 2023-07-12 12:04:50 +08:00 committed by Sébastien Bourdeauducq
parent ac504069d2
commit c17f69a51b
1 changed files with 5 additions and 5 deletions

View File

@ -19,16 +19,16 @@ class XYPlot(pyqtgraph.PlotWidget):
'Error bars': False, 'Error bars': False,
'Fit values': False} 'Fit values': False}
def data_changed(self, data, mods, title): def data_changed(self, value, metadata, persist, mods, title):
try: try:
y = data[self.args.y][1] y = value[self.args.y]
except KeyError: except KeyError:
return return
x = data.get(self.args.x, (False, None))[1] x = value.get(self.args.x, (False, None))
if x is None: if x is None:
x = np.arange(len(y)) x = np.arange(len(y))
error = data.get(self.args.error, (False, None))[1] error = value.get(self.args.error, (False, None))
fit = data.get(self.args.fit, (False, None))[1] fit = value.get(self.args.fit, (False, None))
if not len(y) or len(y) != len(x): if not len(y) or len(y) != len(x):
self.mismatch['X values'] = True self.mismatch['X values'] = True