From 446831af332647a6880c307f1825bbc08f0192bb Mon Sep 17 00:00:00 2001 From: Floyd Wang Date: Tue, 18 Nov 2025 13:52:39 +0800 Subject: [PATCH] chart: Add support to set stroke color on line chart (#1629) Close #1625. image --- crates/story/src/chart_story.rs | 3 ++- crates/ui/src/chart/line_chart.rs | 5 +++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/crates/story/src/chart_story.rs b/crates/story/src/chart_story.rs index e0c04f16..a708b539 100644 --- a/crates/story/src/chart_story.rs +++ b/crates/story/src/chart_story.rs @@ -261,7 +261,8 @@ impl Render for ChartStory { LineChart::new(self.monthly_devices.clone()) .x(|d| d.month.clone()) .y(|d| d.desktop) - .dot(), + .dot() + .stroke(cx.theme().chart_5), false, cx, )), diff --git a/crates/ui/src/chart/line_chart.rs b/crates/ui/src/chart/line_chart.rs index 2b52b32d..15de4c4a 100644 --- a/crates/ui/src/chart/line_chart.rs +++ b/crates/ui/src/chart/line_chart.rs @@ -59,6 +59,11 @@ where self } + pub fn stroke(mut self, stroke: impl Into) -> Self { + self.stroke = Some(stroke.into()); + self + } + pub fn natural(mut self) -> Self { self.stroke_style = StrokeStyle::Natural; self