chart(bar): Fix the label is not centered (#1448)

This commit is contained in:
Floyd Wang 2025-10-28 16:53:42 +08:00 committed by GitHub
parent e005bd0f46
commit 0e2397cf15
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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);