1
0
Fork 0
mirror of https://github.com/alemidev/scope-tui.git synced 2024-11-23 14:14:48 +01:00

feat: split vectorscope in 2 colors by time

This commit is contained in:
əlemi 2022-12-25 21:56:41 +01:00
parent d98f04ae1f
commit ed246e314f
No known key found for this signature in database
GPG key ID: BBCBFE5D7244634E

View file

@ -69,7 +69,7 @@ fn poll_event() -> Result<Option<Event>, std::io::Error> {
fn data_set<'a>( fn data_set<'a>(
name: &'a str, name: &'a str,
data: &'a Vec<(f64, f64)>, data: &'a [(f64, f64)],
marker_type: symbols::Marker, marker_type: symbols::Marker,
graph_type: GraphType, graph_type: GraphType,
axis_color: Color axis_color: Color
@ -198,7 +198,9 @@ fn run_app<T : Backend>(args: Args, terminal: &mut Terminal<T>) -> Result<(), io
if cfg.vectorscope() { if cfg.vectorscope() {
merged = fmt.vectorscope(&mut buffer); 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 { } else {
(left, right) = fmt.oscilloscope(&mut buffer); (left, right) = fmt.oscilloscope(&mut buffer);
datasets.push(data_set("R", &right, cfg.marker_type, cfg.graph_type(), cfg.secondary_color)); datasets.push(data_set("R", &right, cfg.marker_type, cfg.graph_type(), cfg.secondary_color));