forked from M-Labs/thermostat
Get rid of the setpoint line out-of-range problem
This commit is contained in:
parent
6be23451cb
commit
f3e5bb69bf
@ -158,6 +158,7 @@ class ChannelGraphs:
|
||||
|
||||
self._t_line = self._t_widget.getPlotItem().addLine(label='{value} °C')
|
||||
self._t_line.setVisible(False)
|
||||
self._t_setpoint_plot = LiveLinePlot() # Hack for keeping setpoint line in plot range
|
||||
|
||||
for graph in t_widget, i_widget:
|
||||
time_axis = LiveAxis('bottom', text="Time since Thermostat reset", **{Axis.TICK_FORMAT: Axis.DURATION})
|
||||
@ -179,10 +180,12 @@ class ChannelGraphs:
|
||||
i_widget.addLegend(brush=(50, 50, 200, 150))
|
||||
|
||||
t_widget.addItem(self._t_plot)
|
||||
t_widget.addItem(self._t_setpoint_plot)
|
||||
i_widget.addItem(self._i_plot)
|
||||
i_widget.addItem(self._iset_plot)
|
||||
|
||||
self.t_connector = DataConnector(self._t_plot, max_points=self.DEFAULT_MAX_SAMPLES)
|
||||
self.t_setpoint_connector = DataConnector(self._t_setpoint_plot, max_points=1)
|
||||
self.i_connector = DataConnector(self._i_plot, max_points=self.DEFAULT_MAX_SAMPLES)
|
||||
self.iset_connector = DataConnector(self._iset_plot, max_points=self.DEFAULT_MAX_SAMPLES)
|
||||
|
||||
@ -196,6 +199,10 @@ class ChannelGraphs:
|
||||
|
||||
if temperature is not None:
|
||||
self.t_connector.cb_append_data_point(temperature, time)
|
||||
if self._t_line.isVisible():
|
||||
self.t_setpoint_connector.cb_append_data_point(self._t_line.value(), time)
|
||||
else:
|
||||
self.t_setpoint_connector.cb_append_data_point(temperature, time)
|
||||
self.i_connector.cb_append_data_point(current, time)
|
||||
self.iset_connector.cb_append_data_point(iset, time)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user