diff --git a/artiq/dashboard/waveform.py b/artiq/dashboard/waveform.py index 53e250f34..366be19b7 100644 --- a/artiq/dashboard/waveform.py +++ b/artiq/dashboard/waveform.py @@ -186,6 +186,23 @@ class _BaseWaveform(pg.PlotWidget): super().wheelEvent(e) +class AnalogWaveform(_BaseWaveform): + def __init__(self, name, width, parent=None): + _BaseWaveform.__init__(self, name, width, parent) + + def onDataChange(self, data): + try: + x_data, y_data = zip(*data) + self.plot_data_item.setData(x=x_data, y=y_data) + max_y = max(y_data) + min_y = min(y_data) + self.plot_item.setRange(yRange=(min_y, max_y), padding=0.1) + except: + logger.error( + 'Error when displaying waveform: {}'.format(self.name), exc_info=True) + self.plot_data_item.setData(x=[], y=[]) + + class _WaveformView(QtWidgets.QWidget): def __init__(self, parent): QtWidgets.QWidget.__init__(self, parent=parent)