Skip to main content

nominal_api/conjure/objects/scout/chartdefinition/api/
cartesian_chart_definition_v1.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 CartesianChartDefinitionV1 {
13    #[builder(default, list(item(type = super::CartesianPlot)))]
14    #[serde(rename = "plots", skip_serializing_if = "Vec::is_empty", default)]
15    plots: Vec<super::CartesianPlot>,
16    #[builder(default, into)]
17    #[serde(rename = "events", skip_serializing_if = "Option::is_none", default)]
18    events: Option<Vec<super::Event>>,
19    #[builder(
20        default,
21        list(item(type = super::super::super::comparisonrun::api::ComparisonRunGroup))
22    )]
23    #[serde(
24        rename = "comparisonRunGroups",
25        skip_serializing_if = "Vec::is_empty",
26        default
27    )]
28    comparison_run_groups: Vec<
29        super::super::super::comparisonrun::api::ComparisonRunGroup,
30    >,
31    #[builder(default, into)]
32    #[serde(rename = "title", skip_serializing_if = "Option::is_none", default)]
33    title: Option<String>,
34    #[builder(default, list(item(type = super::ValueAxis)))]
35    #[serde(rename = "valueAxes", skip_serializing_if = "Vec::is_empty", default)]
36    value_axes: Vec<super::ValueAxis>,
37    #[builder(
38        default,
39        custom(
40            type = impl
41            Into<Option<super::ScatterDecimation>>,
42            convert = |v|v.into().map(Box::new)
43        )
44    )]
45    #[serde(rename = "decimation", skip_serializing_if = "Option::is_none", default)]
46    decimation: Option<Box<super::ScatterDecimation>>,
47    #[builder(default, into)]
48    #[serde(rename = "connectPoints", skip_serializing_if = "Option::is_none", default)]
49    connect_points: Option<bool>,
50    #[builder(
51        default,
52        custom(
53            type = impl
54            Into<Option<super::FloatingLegendConfig>>,
55            convert = |v|v.into().map(Box::new)
56        )
57    )]
58    #[serde(
59        rename = "floatingLegendsConfig",
60        skip_serializing_if = "Option::is_none",
61        default
62    )]
63    floating_legends_config: Option<Box<super::FloatingLegendConfig>>,
64}
65impl CartesianChartDefinitionV1 {
66    /// Constructs a new instance of the type.
67    #[inline]
68    pub fn new() -> Self {
69        Self::builder().build()
70    }
71    #[inline]
72    pub fn plots(&self) -> &[super::CartesianPlot] {
73        &*self.plots
74    }
75    #[deprecated(note = "Please use the workbook's eventRefs field instead.")]
76    #[inline]
77    pub fn events(&self) -> Option<&[super::Event]> {
78        self.events.as_ref().map(|o| &**o)
79    }
80    #[inline]
81    pub fn comparison_run_groups(
82        &self,
83    ) -> &[super::super::super::comparisonrun::api::ComparisonRunGroup] {
84        &*self.comparison_run_groups
85    }
86    #[inline]
87    pub fn title(&self) -> Option<&str> {
88        self.title.as_ref().map(|o| &**o)
89    }
90    #[inline]
91    pub fn value_axes(&self) -> &[super::ValueAxis] {
92        &*self.value_axes
93    }
94    /// The strategy for bucketing points together.
95    #[inline]
96    pub fn decimation(&self) -> Option<&super::ScatterDecimation> {
97        self.decimation.as_ref().map(|o| &**o)
98    }
99    /// If toggled true, will visually connect the points of the series
100    #[inline]
101    pub fn connect_points(&self) -> Option<bool> {
102        self.connect_points.as_ref().map(|o| *o)
103    }
104    /// Config for showing a floating legend in the chart. If undefined, defaults to hiding.
105    #[inline]
106    pub fn floating_legends_config(&self) -> Option<&super::FloatingLegendConfig> {
107        self.floating_legends_config.as_ref().map(|o| &**o)
108    }
109}