From ed246e314fe472418d05e773c9694a71cb0edd72 Mon Sep 17 00:00:00 2001 From: alemidev Date: Sun, 25 Dec 2022 21:56:41 +0100 Subject: [PATCH] feat: split vectorscope in 2 colors by time --- src/main.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/main.rs b/src/main.rs index b5f42ee..bc77f7c 100644 --- a/src/main.rs +++ b/src/main.rs @@ -69,7 +69,7 @@ fn poll_event() -> Result, std::io::Error> { fn data_set<'a>( name: &'a str, - data: &'a Vec<(f64, f64)>, + data: &'a [(f64, f64)], marker_type: symbols::Marker, graph_type: GraphType, axis_color: Color @@ -198,7 +198,9 @@ fn run_app(args: Args, terminal: &mut Terminal) -> Result<(), io if cfg.vectorscope() { merged = fmt.vectorscope(&mut buffer); - datasets.push(data_set("V", &merged, cfg.marker_type, cfg.graph_type(), cfg.primary_color)); + let pivot = merged.len() / 2; + datasets.push(data_set("1", &merged[..pivot], cfg.marker_type, cfg.graph_type(), cfg.secondary_color)); + datasets.push(data_set("2", &merged[pivot..], cfg.marker_type, cfg.graph_type(), cfg.primary_color)); } else { (left, right) = fmt.oscilloscope(&mut buffer); datasets.push(data_set("R", &right, cfg.marker_type, cfg.graph_type(), cfg.secondary_color));