#[derive(
Debug,
Clone,
conjure_object::serde::Serialize,
conjure_object::serde::Deserialize,
conjure_object::private::DeriveWith
)]
#[serde(crate = "conjure_object::serde")]
#[derive_with(PartialEq, Eq, PartialOrd, Ord, Hash)]
#[conjure_object::private::staged_builder::staged_builder]
#[builder(crate = conjure_object::private::staged_builder, update, inline)]
pub struct HistogramChartDefinitionV1 {
#[builder(default, list(item(type = super::HistogramPlot)))]
#[serde(rename = "plots", skip_serializing_if = "Vec::is_empty", default)]
plots: Vec<super::HistogramPlot>,
#[builder(default, into)]
#[serde(rename = "title", skip_serializing_if = "Option::is_none", default)]
title: Option<String>,
#[builder(custom(type = super::HistogramDisplaySettings, convert = Box::new))]
#[serde(rename = "displaySettings")]
display_settings: Box<super::HistogramDisplaySettings>,
#[builder(
default,
custom(
type = impl
Into<Option<super::super::super::compute::api::NumericHistogramBucketStrategy>>,
convert = |v|v.into().map(Box::new)
)
)]
#[serde(
rename = "numericBucketStrategy",
skip_serializing_if = "Option::is_none",
default
)]
numeric_bucket_strategy: Option<
Box<super::super::super::compute::api::NumericHistogramBucketStrategy>,
>,
#[builder(
default,
custom(
type = impl
Into<Option<super::ValueAxis>>,
convert = |v|v.into().map(Box::new)
)
)]
#[serde(rename = "valueAxis", skip_serializing_if = "Option::is_none", default)]
value_axis: Option<Box<super::ValueAxis>>,
}
impl HistogramChartDefinitionV1 {
#[inline]
pub fn new(display_settings: super::HistogramDisplaySettings) -> Self {
Self::builder().display_settings(display_settings).build()
}
#[inline]
pub fn plots(&self) -> &[super::HistogramPlot] {
&*self.plots
}
#[inline]
pub fn title(&self) -> Option<&str> {
self.title.as_ref().map(|o| &**o)
}
#[inline]
pub fn display_settings(&self) -> &super::HistogramDisplaySettings {
&*self.display_settings
}
#[inline]
pub fn numeric_bucket_strategy(
&self,
) -> Option<&super::super::super::compute::api::NumericHistogramBucketStrategy> {
self.numeric_bucket_strategy.as_ref().map(|o| &**o)
}
#[inline]
pub fn value_axis(&self) -> Option<&super::ValueAxis> {
self.value_axis.as_ref().map(|o| &**o)
}
}