Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: line z, silent, charming disabled options #130

Merged
merged 4 commits into from
Dec 14, 2024
Merged
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
9 changes: 9 additions & 0 deletions charming/src/element/emphasis.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ pub struct Emphasis {

#[serde(skip_serializing_if = "Option::is_none")]
label: Option<Label>,

#[serde(skip_serializing_if = "Option::is_none")]
disabled: Option<bool>,
}

impl Default for Emphasis {
Expand All @@ -44,6 +47,7 @@ impl Emphasis {
item_style: None,
area_style: None,
label: None,
disabled: None,
}
}

Expand All @@ -66,4 +70,9 @@ impl Emphasis {
self.label = Some(label.into());
self
}

pub fn disabled(mut self, disabled: bool) -> Self {
self.disabled = Some(disabled);
self
}
}
18 changes: 18 additions & 0 deletions charming/src/series/line.rs
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,12 @@ pub struct Line {
#[serde(skip_serializing_if = "Option::is_none")]
tooltip: Option<Tooltip>,

#[serde(skip_serializing_if = "Option::is_none")]
silent: Option<bool>,

#[serde(skip_serializing_if = "Option::is_none")]
z: Option<i32>,

#[serde(skip_serializing_if = "Vec::is_empty")]
data: DataFrame,
}
Expand Down Expand Up @@ -116,6 +122,8 @@ impl Line {
x_axis_index: None,
y_axis_index: None,
tooltip: None,
silent: None,
z: None,
data: vec![],
}
}
Expand Down Expand Up @@ -232,6 +240,16 @@ impl Line {
self
}

pub fn silent(mut self, silent: bool) -> Self {
self.silent = Some(silent);
self
}

pub fn z<I: Into<i32>>(mut self, z: I) -> Self {
self.z = Some(z.into());
self
}

pub fn data<D: Into<DataPoint>>(mut self, data: Vec<D>) -> Self {
self.data = data.into_iter().map(|d| d.into()).collect();
self
Expand Down
Loading