Skip to main content

nominal_api/conjure/objects/scout/chartdefinition/api/
axis_display_options.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 AxisDisplayOptions {
13    #[serde(rename = "showTitle")]
14    show_title: bool,
15    #[builder(default, into)]
16    #[serde(rename = "axisWidth", skip_serializing_if = "Option::is_none", default)]
17    #[derive_with(with = conjure_object::private::DoubleWrapper)]
18    axis_width: Option<f64>,
19    #[builder(default, into)]
20    #[serde(rename = "scaleType", skip_serializing_if = "Option::is_none", default)]
21    scale_type: Option<super::AxisScaleType>,
22}
23impl AxisDisplayOptions {
24    /// Constructs a new instance of the type.
25    #[inline]
26    pub fn new(show_title: bool) -> Self {
27        Self::builder().show_title(show_title).build()
28    }
29    #[inline]
30    pub fn show_title(&self) -> bool {
31        self.show_title
32    }
33    #[inline]
34    pub fn axis_width(&self) -> Option<f64> {
35        self.axis_width.as_ref().map(|o| *o)
36    }
37    /// The scale type of the axis. If not specified, the default is LINEAR.
38    #[inline]
39    pub fn scale_type(&self) -> Option<&super::AxisScaleType> {
40        self.scale_type.as_ref().map(|o| &*o)
41    }
42}