From 0e2397cf15937c50813cb52b247ff9732f18d487 Mon Sep 17 00:00:00 2001 From: Floyd Wang Date: Tue, 28 Oct 2025 16:53:42 +0800 Subject: [PATCH] chart(bar): Fix the label is not centered (#1448) --- crates/ui/src/chart/bar_chart.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/crates/ui/src/chart/bar_chart.rs b/crates/ui/src/chart/bar_chart.rs index 33487bbe..21036950 100644 --- a/crates/ui/src/chart/bar_chart.rs +++ b/crates/ui/src/chart/bar_chart.rs @@ -154,7 +154,9 @@ where if let Some(label) = self.label.as_ref() { let label = label.clone(); - bar = bar.label(move |d, p| vec![Text::new(label(d), p, label_color)]); + bar = bar.label(move |d, p| { + vec![Text::new(label(d), p, label_color).align(TextAlign::Center)] + }); } bar.paint(&bounds, window, cx);