diff --git a/plotly/src/traces/bar.rs b/plotly/src/traces/bar.rs index 86525f03..f14af012 100644 --- a/plotly/src/traces/bar.rs +++ b/plotly/src/traces/bar.rs @@ -101,6 +101,9 @@ where x_calendar: Option, #[serde(rename = "ycalendar")] y_calendar: Option, + /// Sets the stacking order of this trace. SVG traces with a higher `zorder` + /// value are rendered on top of those with lower `zorder` values. + zorder: Option, } impl Bar @@ -226,4 +229,19 @@ mod tests { assert_eq!(to_value(bar).unwrap(), expected); } + + #[test] + fn serialize_bar_zorder() { + let trace = Bar::new(vec![1, 2], vec![3, 4]) + .zorder(5); + + let expected = json!({ + "type": "bar", + "x": [1, 2], + "y": [3, 4], + "zorder": 5, + }); + + assert_eq!(to_value(trace).unwrap(), expected); + } } diff --git a/plotly/src/traces/scatter.rs b/plotly/src/traces/scatter.rs index 6f5424bf..47b83efe 100644 --- a/plotly/src/traces/scatter.rs +++ b/plotly/src/traces/scatter.rs @@ -287,6 +287,9 @@ where /// Sets the calendar system to use with `y` date data. #[serde(rename = "ycalendar")] y_calendar: Option, + /// Sets the stacking order of this trace. SVG traces with a higher `zorder` + /// value are rendered on top of those with lower `zorder` values. + zorder: Option, } impl Scatter @@ -550,4 +553,19 @@ mod tests { assert_eq!(to_value(trace).unwrap(), expected); } + + #[test] + fn serialize_scatter_zorder() { + let trace = Scatter::new(vec![0, 1], vec![2, 3]) + .zorder(3); + + let expected = json!({ + "type": "scatter", + "x": [0, 1], + "y": [2, 3], + "zorder": 3, + }); + + assert_eq!(to_value(trace).unwrap(), expected); + } } diff --git a/plotly_static/Cargo.toml b/plotly_static/Cargo.toml index 39b3b5f8..953c73c7 100644 --- a/plotly_static/Cargo.toml +++ b/plotly_static/Cargo.toml @@ -13,6 +13,7 @@ keywords = ["plotly", "static", "image", "export", "webdriver"] exclude = ["target/*"] [features] +default = ["chromedriver"] webdriver_download = [] geckodriver = [] chromedriver = []