Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions plotly/src/traces/bar.rs
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,9 @@ where
x_calendar: Option<Calendar>,
#[serde(rename = "ycalendar")]
y_calendar: Option<Calendar>,
/// 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<i32>,
}

impl<X, Y> Bar<X, Y>
Expand Down Expand Up @@ -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);
}
}
18 changes: 18 additions & 0 deletions plotly/src/traces/scatter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,9 @@ where
/// Sets the calendar system to use with `y` date data.
#[serde(rename = "ycalendar")]
y_calendar: Option<Calendar>,
/// 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<i32>,
}

impl<X, Y> Scatter<X, Y>
Expand Down Expand Up @@ -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);
}
}
1 change: 1 addition & 0 deletions plotly_static/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ keywords = ["plotly", "static", "image", "export", "webdriver"]
exclude = ["target/*"]

[features]
default = ["chromedriver"]
webdriver_download = []
geckodriver = []
chromedriver = []
Expand Down
Loading