Skip to main content

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

1#[derive(
2    Debug,
3    Clone,
4    conjure_object::serde::Serialize,
5    conjure_object::serde::Deserialize,
6    PartialEq,
7    Eq,
8    PartialOrd,
9    Ord,
10    Hash
11)]
12#[serde(crate = "conjure_object::serde")]
13#[conjure_object::private::staged_builder::staged_builder]
14#[builder(crate = conjure_object::private::staged_builder, update, inline)]
15pub struct PlotlyPanelDefinitionV1 {
16    #[builder(default, into)]
17    #[serde(rename = "title", skip_serializing_if = "Option::is_none", default)]
18    title: Option<String>,
19    #[builder(default, into)]
20    #[serde(rename = "preset", skip_serializing_if = "Option::is_none", default)]
21    preset: Option<super::PlotlyPreset>,
22    #[builder(custom(type = super::Figure, convert = Box::new))]
23    #[serde(rename = "figure")]
24    figure: Box<super::Figure>,
25}
26impl PlotlyPanelDefinitionV1 {
27    /// Constructs a new instance of the type.
28    #[inline]
29    pub fn new(figure: super::Figure) -> Self {
30        Self::builder().figure(figure).build()
31    }
32    #[inline]
33    pub fn title(&self) -> Option<&str> {
34        self.title.as_ref().map(|o| &**o)
35    }
36    /// A preset that will render a nominal-defined plotly figure with minimum necessary inputs
37    #[inline]
38    pub fn preset(&self) -> Option<&super::PlotlyPreset> {
39        self.preset.as_ref().map(|o| &*o)
40    }
41    /// The plotly instance definition, with extra fields for nominal-specific inputs
42    #[inline]
43    pub fn figure(&self) -> &super::Figure {
44        &*self.figure
45    }
46}