Skip to content

Commit

Permalink
Merge pull request #123 from LukaOber/add_start_value
Browse files Browse the repository at this point in the history
Added start_value to axis types
  • Loading branch information
LukaOber authored Nov 11, 2024
2 parents f36f84e + 9b7d532 commit f48d591
Show file tree
Hide file tree
Showing 5 changed files with 45 additions and 0 deletions.
9 changes: 9 additions & 0 deletions charming/src/component/angle_axis.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,9 @@ pub struct AngleAxis {
#[serde(skip_serializing_if = "Option::is_none")]
log_base: Option<f64>,

#[serde(skip_serializing_if = "Option::is_none")]
start_value: Option<f64>,

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

Expand Down Expand Up @@ -128,6 +131,7 @@ impl AngleAxis {
max_interval: None,
interval: None,
log_base: None,
start_value: None,
silent: None,
trigger_event: None,
axis_line: None,
Expand Down Expand Up @@ -227,6 +231,11 @@ impl AngleAxis {
self
}

pub fn start_value<F: Into<f64>>(mut self, start_value: F) -> Self {
self.start_value = Some(start_value.into());
self
}

pub fn silent(mut self, silent: bool) -> Self {
self.silent = Some(silent);
self
Expand Down
9 changes: 9 additions & 0 deletions charming/src/component/axis.rs
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,9 @@ pub struct Axis {
#[serde(skip_serializing_if = "Option::is_none")]
log_base: Option<f64>,

#[serde(skip_serializing_if = "Option::is_none")]
start_value: Option<f64>,

/// Settings related to axis label.
#[serde(skip_serializing_if = "Option::is_none")]
axis_label: Option<AxisLabel>,
Expand Down Expand Up @@ -157,6 +160,7 @@ impl Axis {
interval: None,
align_ticks: None,
log_base: None,
start_value: None,
axis_label: None,
axis_tick: None,
axis_line: None,
Expand Down Expand Up @@ -277,6 +281,11 @@ impl Axis {
self
}

pub fn start_value<F: Into<f64>>(mut self, start_value: F) -> Self {
self.start_value = Some(start_value.into());
self
}

pub fn axis_label<L: Into<AxisLabel>>(mut self, axis_label: L) -> Self {
self.axis_label = Some(axis_label.into());
self
Expand Down
9 changes: 9 additions & 0 deletions charming/src/component/parallel_axis.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@ pub struct ParallelAxis {
#[serde(skip_serializing_if = "Option::is_none")]
min: Option<f64>,

#[serde(skip_serializing_if = "Option::is_none")]
start_value: Option<f64>,

#[serde(skip_serializing_if = "Vec::is_empty")]
data: Vec<String>,
}
Expand All @@ -59,6 +62,7 @@ impl ParallelAxis {
inverse: None,
max: None,
min: None,
start_value: None,
data: vec![],
}
}
Expand Down Expand Up @@ -113,6 +117,11 @@ impl ParallelAxis {
self
}

pub fn start_value<F: Into<f64>>(mut self, start_value: F) -> Self {
self.start_value = Some(start_value.into());
self
}

pub fn data<S: Into<String>>(mut self, data: Vec<S>) -> Self {
self.data = data.into_iter().map(|s| s.into()).collect();
self
Expand Down
9 changes: 9 additions & 0 deletions charming/src/component/radius_axis.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,9 @@ pub struct RadiusAxis {
#[serde(skip_serializing_if = "Option::is_none")]
log_base: Option<f64>,

#[serde(skip_serializing_if = "Option::is_none")]
start_value: Option<f64>,

#[serde(skip_serializing_if = "Option::is_none")]
axis_label: Option<AxisLabel>,

Expand Down Expand Up @@ -97,6 +100,7 @@ impl RadiusAxis {
max_interval: None,
interval: None,
log_base: None,
start_value: None,
axis_label: None,
axis_line: None,
data: vec![],
Expand Down Expand Up @@ -193,6 +197,11 @@ impl RadiusAxis {
self
}

pub fn start_value<F: Into<f64>>(mut self, start_value: F) -> Self {
self.start_value = Some(start_value.into());
self
}

pub fn axis_label<A: Into<AxisLabel>>(mut self, axis_label: A) -> Self {
self.axis_label = Some(axis_label.into());
self
Expand Down
9 changes: 9 additions & 0 deletions charming/src/component/single_axis.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,9 @@ pub struct SingleAxis {

#[serde(skip_serializing_if = "Option::is_none")]
max: Option<String>,

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

impl Default for SingleAxis {
Expand All @@ -73,6 +76,7 @@ impl SingleAxis {
inverse: None,
min: None,
max: None,
start_value: None,
}
}

Expand Down Expand Up @@ -135,4 +139,9 @@ impl SingleAxis {
self.max = Some(max.into());
self
}

pub fn start_value<F: Into<f64>>(mut self, start_value: F) -> Self {
self.start_value = Some(start_value.into());
self
}
}

0 comments on commit f48d591

Please sign in to comment.