From dc0baded17d3681003a1661fe0d9f0741eccac3d Mon Sep 17 00:00:00 2001 From: Ora9 Date: Wed, 22 Jul 2026 00:21:55 +0200 Subject: [PATCH] fix: chart legend follow cfg `show_ui` --- src/app.rs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) 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) })?; }