diff --git a/src/app.rs b/src/app.rs index 689a19a..07c4aff 100644 --- a/src/app.rs +++ b/src/app.rs @@ -4,8 +4,7 @@ use ratatui::{ layout::{Constraint, Rect}, style::{Modifier, Style}, symbols::Marker, - widgets::Chart, - widgets::{Cell, Row, Table}, + widgets::{Cell, Chart, LegendPosition, Row, Table}, Terminal, }; use std::{ @@ -131,7 +130,11 @@ impl App { } let chart = Chart::new(datasets.iter().map(|x| x.into()).collect()) .x_axis(self.current_display().axis(&self.graph, Dimension::X)) // TODO allow to have axis sometimes? - .y_axis(self.current_display().axis(&self.graph, Dimension::Y)); + .y_axis(self.current_display().axis(&self.graph, Dimension::Y)) + .legend_position(match self.graph.show_ui { + false => None, + true => Some(LegendPosition::TopRight), + }); f.render_widget(chart, size) })?; }