Skip to main content

nominal_api/conjure/objects/scout/chartdefinition/api/
value_axis.rs

1#[derive(
2    Debug,
3    Clone,
4    conjure_object::serde::Serialize,
5    conjure_object::serde::Deserialize,
6    conjure_object::private::DeriveWith
7)]
8#[serde(crate = "conjure_object::serde")]
9#[derive_with(PartialEq, Eq, PartialOrd, Ord, Hash)]
10#[conjure_object::private::staged_builder::staged_builder]
11#[builder(crate = conjure_object::private::staged_builder, update, inline)]
12pub struct ValueAxis {
13    #[builder(into)]
14    #[serde(rename = "id")]
15    id: String,
16    #[builder(into)]
17    #[serde(rename = "title")]
18    title: String,
19    #[builder(custom(type = super::AxisDisplayOptions, convert = Box::new))]
20    #[serde(rename = "displayOptions")]
21    display_options: Box<super::AxisDisplayOptions>,
22    #[builder(custom(type = super::AxisRange, convert = Box::new))]
23    #[serde(rename = "range")]
24    range: Box<super::AxisRange>,
25    #[builder(custom(type = super::AxisRange, convert = Box::new))]
26    #[serde(rename = "limit")]
27    limit: Box<super::AxisRange>,
28    #[serde(rename = "position")]
29    position: super::AxisPosition,
30    #[serde(rename = "domainType")]
31    domain_type: super::AxisDomainType,
32    #[builder(
33        default,
34        custom(
35            type = impl
36            Into<Option<super::NumberFormat>>,
37            convert = |v|v.into().map(Box::new)
38        )
39    )]
40    #[serde(
41        rename = "tickNumberFormat",
42        skip_serializing_if = "Option::is_none",
43        default
44    )]
45    tick_number_format: Option<Box<super::NumberFormat>>,
46    #[builder(
47        default,
48        custom(
49            type = impl
50            Into<Option<super::NumberFormat>>,
51            convert = |v|v.into().map(Box::new)
52        )
53    )]
54    #[serde(
55        rename = "tooltipNumberFormat",
56        skip_serializing_if = "Option::is_none",
57        default
58    )]
59    tooltip_number_format: Option<Box<super::NumberFormat>>,
60    #[builder(default, into)]
61    #[serde(rename = "reversed", skip_serializing_if = "Option::is_none", default)]
62    reversed: Option<bool>,
63}
64impl ValueAxis {
65    #[inline]
66    pub fn id(&self) -> &str {
67        &*self.id
68    }
69    #[inline]
70    pub fn title(&self) -> &str {
71        &*self.title
72    }
73    #[inline]
74    pub fn display_options(&self) -> &super::AxisDisplayOptions {
75        &*self.display_options
76    }
77    #[inline]
78    pub fn range(&self) -> &super::AxisRange {
79        &*self.range
80    }
81    #[inline]
82    pub fn limit(&self) -> &super::AxisRange {
83        &*self.limit
84    }
85    #[inline]
86    pub fn position(&self) -> &super::AxisPosition {
87        &self.position
88    }
89    #[inline]
90    pub fn domain_type(&self) -> &super::AxisDomainType {
91        &self.domain_type
92    }
93    #[inline]
94    pub fn tick_number_format(&self) -> Option<&super::NumberFormat> {
95        self.tick_number_format.as_ref().map(|o| &**o)
96    }
97    #[inline]
98    pub fn tooltip_number_format(&self) -> Option<&super::NumberFormat> {
99        self.tooltip_number_format.as_ref().map(|o| &**o)
100    }
101    /// Whether the axis direction is reversed. When true, larger values appear on the
102    /// opposite side (left for X axis, bottom for Y axis). Defaults to false.
103    #[inline]
104    pub fn reversed(&self) -> Option<bool> {
105        self.reversed.as_ref().map(|o| *o)
106    }
107}