| 1 | //! Code around a temperature graph widget. |
| 2 | |
| 3 | use std::time::Instant; |
| 4 | |
| 5 | use crate::components::time_series::{AutoYAxisTimeGraph, TimeseriesConfig}; |
| 6 | |
| 7 | /// A time series graph widget displaying temperature usage over time. |
| 8 | pub struct TempGraphWidgetState { |
| 9 | pub graph: AutoYAxisTimeGraph, |
| 10 | pub max_temp: Option<f32>, |
| 11 | } |
| 12 | |
| 13 | impl TempGraphWidgetState { |
| 14 | pub fn new( |
| 15 | config: TimeseriesConfig, autohide_timer: Option<Instant>, max_temp: Option<f32>, |
| 16 | ) -> Self { |
| 17 | TempGraphWidgetState { |
| 18 | graph: AutoYAxisTimeGraph::new(config, autohide_timer), |
| 19 | max_temp, |
| 20 | } |
| 21 | } |
| 22 | } |