Skip to main content

nominal_api/conjure/objects/scout/chartdefinition/api/
frequency_chart_definition_v2.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 FrequencyChartDefinitionV2 {
13    #[builder(default, list(item(type = super::FrequencyPlotV2)))]
14    #[serde(rename = "plots", skip_serializing_if = "Vec::is_empty", default)]
15    plots: Vec<super::FrequencyPlotV2>,
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::FrequencyPlotType>>,
42            convert = |v|v.into().map(Box::new)
43        )
44    )]
45    #[serde(rename = "plotType", skip_serializing_if = "Option::is_none", default)]
46    plot_type: Option<Box<super::FrequencyPlotType>>,
47}
48impl FrequencyChartDefinitionV2 {
49    /// Constructs a new instance of the type.
50    #[inline]
51    pub fn new() -> Self {
52        Self::builder().build()
53    }
54    #[inline]
55    pub fn plots(&self) -> &[super::FrequencyPlotV2] {
56        &*self.plots
57    }
58    #[deprecated(note = "Please use the workbook's eventRefs field instead.")]
59    #[inline]
60    pub fn events(&self) -> Option<&[super::Event]> {
61        self.events.as_ref().map(|o| &**o)
62    }
63    #[inline]
64    pub fn comparison_run_groups(
65        &self,
66    ) -> &[super::super::super::comparisonrun::api::ComparisonRunGroup] {
67        &*self.comparison_run_groups
68    }
69    #[inline]
70    pub fn title(&self) -> Option<&str> {
71        self.title.as_ref().map(|o| &**o)
72    }
73    #[inline]
74    pub fn value_axes(&self) -> &[super::ValueAxis] {
75        &*self.value_axes
76    }
77    /// The type of plot to display. If not specified, the default is FFT.
78    #[inline]
79    pub fn plot_type(&self) -> Option<&super::FrequencyPlotType> {
80        self.plot_type.as_ref().map(|o| &**o)
81    }
82}