From 9b7d532d4c285b53a04d5a54a0f769e7cd14145e Mon Sep 17 00:00:00 2001 From: LukaOber Date: Mon, 11 Nov 2024 11:23:08 +0100 Subject: [PATCH] added start_value to axis types --- charming/src/component/angle_axis.rs | 9 +++++++++ charming/src/component/axis.rs | 9 +++++++++ charming/src/component/parallel_axis.rs | 9 +++++++++ charming/src/component/radius_axis.rs | 9 +++++++++ charming/src/component/single_axis.rs | 9 +++++++++ 5 files changed, 45 insertions(+) diff --git a/charming/src/component/angle_axis.rs b/charming/src/component/angle_axis.rs index 701e0c8..4b4173f 100644 --- a/charming/src/component/angle_axis.rs +++ b/charming/src/component/angle_axis.rs @@ -68,6 +68,9 @@ pub struct AngleAxis { #[serde(skip_serializing_if = "Option::is_none")] log_base: Option, + #[serde(skip_serializing_if = "Option::is_none")] + start_value: Option, + #[serde(skip_serializing_if = "Option::is_none")] silent: Option, @@ -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, @@ -227,6 +231,11 @@ impl AngleAxis { self } + pub fn start_value>(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 diff --git a/charming/src/component/axis.rs b/charming/src/component/axis.rs index f7d5448..397d872 100644 --- a/charming/src/component/axis.rs +++ b/charming/src/component/axis.rs @@ -98,6 +98,9 @@ pub struct Axis { #[serde(skip_serializing_if = "Option::is_none")] log_base: Option, + #[serde(skip_serializing_if = "Option::is_none")] + start_value: Option, + /// Settings related to axis label. #[serde(skip_serializing_if = "Option::is_none")] axis_label: Option, @@ -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, @@ -277,6 +281,11 @@ impl Axis { self } + pub fn start_value>(mut self, start_value: F) -> Self { + self.start_value = Some(start_value.into()); + self + } + pub fn axis_label>(mut self, axis_label: L) -> Self { self.axis_label = Some(axis_label.into()); self diff --git a/charming/src/component/parallel_axis.rs b/charming/src/component/parallel_axis.rs index dd925d4..ecda2b1 100644 --- a/charming/src/component/parallel_axis.rs +++ b/charming/src/component/parallel_axis.rs @@ -36,6 +36,9 @@ pub struct ParallelAxis { #[serde(skip_serializing_if = "Option::is_none")] min: Option, + #[serde(skip_serializing_if = "Option::is_none")] + start_value: Option, + #[serde(skip_serializing_if = "Vec::is_empty")] data: Vec, } @@ -59,6 +62,7 @@ impl ParallelAxis { inverse: None, max: None, min: None, + start_value: None, data: vec![], } } @@ -113,6 +117,11 @@ impl ParallelAxis { self } + pub fn start_value>(mut self, start_value: F) -> Self { + self.start_value = Some(start_value.into()); + self + } + pub fn data>(mut self, data: Vec) -> Self { self.data = data.into_iter().map(|s| s.into()).collect(); self diff --git a/charming/src/component/radius_axis.rs b/charming/src/component/radius_axis.rs index aa7ec7d..8531f87 100644 --- a/charming/src/component/radius_axis.rs +++ b/charming/src/component/radius_axis.rs @@ -60,6 +60,9 @@ pub struct RadiusAxis { #[serde(skip_serializing_if = "Option::is_none")] log_base: Option, + #[serde(skip_serializing_if = "Option::is_none")] + start_value: Option, + #[serde(skip_serializing_if = "Option::is_none")] axis_label: Option, @@ -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![], @@ -193,6 +197,11 @@ impl RadiusAxis { self } + pub fn start_value>(mut self, start_value: F) -> Self { + self.start_value = Some(start_value.into()); + self + } + pub fn axis_label>(mut self, axis_label: A) -> Self { self.axis_label = Some(axis_label.into()); self diff --git a/charming/src/component/single_axis.rs b/charming/src/component/single_axis.rs index bf4b2df..7b228b6 100644 --- a/charming/src/component/single_axis.rs +++ b/charming/src/component/single_axis.rs @@ -50,6 +50,9 @@ pub struct SingleAxis { #[serde(skip_serializing_if = "Option::is_none")] max: Option, + + #[serde(skip_serializing_if = "Option::is_none")] + start_value: Option, } impl Default for SingleAxis { @@ -73,6 +76,7 @@ impl SingleAxis { inverse: None, min: None, max: None, + start_value: None, } } @@ -135,4 +139,9 @@ impl SingleAxis { self.max = Some(max.into()); self } + + pub fn start_value>(mut self, start_value: F) -> Self { + self.start_value = Some(start_value.into()); + self + } }