Skip to main content

nominal_api/conjure/objects/scout/chartdefinition/api/
cartesian_plot.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 CartesianPlot {
13    #[serde(rename = "xVariableName")]
14    x_variable_name: super::super::super::channelvariables::api::ChannelVariableName,
15    #[serde(rename = "yVariableName")]
16    y_variable_name: super::super::super::channelvariables::api::ChannelVariableName,
17    #[builder(default, into)]
18    #[serde(
19        rename = "secondaryVariables",
20        skip_serializing_if = "Option::is_none",
21        default
22    )]
23    secondary_variables: Option<Vec<super::SecondaryVariable>>,
24    #[builder(default, into)]
25    #[serde(rename = "enabled", skip_serializing_if = "Option::is_none", default)]
26    enabled: Option<bool>,
27    #[serde(rename = "xAxisId")]
28    x_axis_id: super::AxisId,
29    #[serde(rename = "yAxisId")]
30    y_axis_id: super::AxisId,
31    #[serde(rename = "color")]
32    color: super::super::super::api::HexColor,
33    #[builder(
34        default,
35        custom(
36            type = impl
37            Into<Option<super::ColorBy>>,
38            convert = |v|v.into().map(Box::new)
39        )
40    )]
41    #[serde(rename = "colorBy", skip_serializing_if = "Option::is_none", default)]
42    color_by: Option<Box<super::ColorBy>>,
43}
44impl CartesianPlot {
45    #[inline]
46    pub fn x_variable_name(
47        &self,
48    ) -> &super::super::super::channelvariables::api::ChannelVariableName {
49        &self.x_variable_name
50    }
51    #[inline]
52    pub fn y_variable_name(
53        &self,
54    ) -> &super::super::super::channelvariables::api::ChannelVariableName {
55        &self.y_variable_name
56    }
57    #[inline]
58    pub fn secondary_variables(&self) -> Option<&[super::SecondaryVariable]> {
59        self.secondary_variables.as_ref().map(|o| &**o)
60    }
61    #[inline]
62    pub fn enabled(&self) -> Option<bool> {
63        self.enabled.as_ref().map(|o| *o)
64    }
65    #[inline]
66    pub fn x_axis_id(&self) -> &super::AxisId {
67        &self.x_axis_id
68    }
69    #[inline]
70    pub fn y_axis_id(&self) -> &super::AxisId {
71        &self.y_axis_id
72    }
73    /// Default color for points
74    #[inline]
75    pub fn color(&self) -> &super::super::super::api::HexColor {
76        &self.color
77    }
78    /// Configuration for dynamic coloring. Overrides color if specified.
79    #[inline]
80    pub fn color_by(&self) -> Option<&super::ColorBy> {
81        self.color_by.as_ref().map(|o| &**o)
82    }
83}