waveform: remove empty waveform error msg

This commit is contained in:
Simon Renblad 2024-02-19 10:35:07 +08:00 committed by Sébastien Bourdeauducq
parent de539a4d33
commit 652bcc22c6

View File

@ -200,7 +200,8 @@ class _BaseWaveform(pg.PlotWidget):
def setData(self, data): def setData(self, data):
if len(data) == 0: if len(data) == 0:
raise ValueError("no timeseries data to display for this channel") self.x_data, self.y_data = [], []
else:
self.x_data, self.y_data = zip(*data) self.x_data, self.y_data = zip(*data)
def onDataChange(self, data): def onDataChange(self, data):
@ -293,6 +294,7 @@ class AnalogWaveform(_BaseWaveform):
try: try:
self.setData(data) self.setData(data)
self.plot_data_item.setData(x=self.x_data, y=self.y_data) self.plot_data_item.setData(x=self.x_data, y=self.y_data)
if len(data) > 0:
max_y = max(self.y_data) max_y = max(self.y_data)
min_y = min(self.y_data) min_y = min(self.y_data)
self.plot_item.setRange(yRange=(min_y, max_y), padding=0.1) self.plot_item.setRange(yRange=(min_y, max_y), padding=0.1)