Skip to content

Commit

Permalink
Merge pull request #130 from KG32/feat/line_emphasis_new_options
Browse files Browse the repository at this point in the history
feat: line z, silent, charming disabled options
  • Loading branch information
LukaOber authored Dec 14, 2024
2 parents b67605f + aed12f4 commit c09911c
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 0 deletions.
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

0 comments on commit c09911c

Please sign in to comment.