From 375c8d5e5e864f986637992c521d0ac165cbdf58 Mon Sep 17 00:00:00 2001 From: alemidev Date: Sat, 18 Jun 2022 19:44:23 +0200 Subject: [PATCH] fix: optimized --- src/app/gui/panel.rs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/app/gui/panel.rs b/src/app/gui/panel.rs index a13177d..59e1df9 100644 --- a/src/app/gui/panel.rs +++ b/src/app/gui/panel.rs @@ -129,14 +129,14 @@ pub fn panel_body_ui(ui: &mut Ui, panel: &mut Panel, sources: &Vec) { } p.show(ui, |plot_ui| { + let _now = Utc::now().timestamp() as f64; + let _off = (panel.view_offset as f64) * 60.0; // TODO multiplying x60 makes sense only for timeseries + let _size = (panel.view_size as f64) * 60.0; // TODO multiplying x60 makes sense only for timeseries + let min_x = if panel.limit { Some(_now - _size - _off) } else { None }; + let max_x = if panel.shift { Some(_now - _off) } else { None }; + let chunk_size = if panel.reduce { Some(panel.view_chunks) } else { None }; for source in sources { if source.panel_id == panel.id { - let _now = Utc::now().timestamp() as f64; - let _off = (panel.view_offset as f64) * 60.0; // TODO multiplying x60 makes sense only for timeseries - let _size = (panel.view_size as f64) * 60.0; // TODO multiplying x60 makes sense only for timeseries - let min_x = if panel.limit { Some(_now - _size - _off) } else { None }; - let max_x = if panel.shift { Some(_now - _off) } else { None }; - let chunk_size = if panel.reduce { Some(panel.view_chunks) } else { None }; // let chunks = None; let line = Line::new(source.values(min_x, max_x, chunk_size)).name(source.name.as_str()); plot_ui.line(line.color(source.color));