#[allow(unused_imports)]
use serde::Serialize;
#[derive(Default, Serialize)]
pub struct Treemap<'a> {
#[serde(rename = "visible")]
#[serde(skip_serializing_if = "Option::is_none")]
visible: Option<Visible>,
#[serde(rename = "opacity")]
#[serde(skip_serializing_if = "Option::is_none")]
opacity: Option<f64>,
#[serde(rename = "name")]
#[serde(skip_serializing_if = "Option::is_none")]
name: Option<&'a str>,
#[serde(rename = "uid")]
#[serde(skip_serializing_if = "Option::is_none")]
uid: Option<&'a str>,
#[serde(rename = "ids")]
#[serde(skip_serializing_if = "Option::is_none")]
ids: Option<&'a [&'a str]>,
#[serde(rename = "meta")]
#[serde(skip_serializing_if = "Option::is_none")]
meta: Option<crate::Any>,
#[serde(rename = "hoverlabel")]
#[serde(skip_serializing_if = "crate::IsEmpty::is_empty")]
hoverlabel: crate::IsEmpty<Hoverlabel<'a>>,
#[serde(rename = "stream")]
#[serde(skip_serializing_if = "crate::IsEmpty::is_empty")]
stream: crate::IsEmpty<Stream<'a>>,
#[serde(rename = "uirevision")]
#[serde(skip_serializing_if = "Option::is_none")]
uirevision: Option<crate::Any>,
#[serde(rename = "labels")]
#[serde(skip_serializing_if = "Option::is_none")]
labels: Option<&'a [f64]>,
#[serde(rename = "parents")]
#[serde(skip_serializing_if = "Option::is_none")]
parents: Option<&'a [f64]>,
#[serde(rename = "values")]
#[serde(skip_serializing_if = "Option::is_none")]
values: Option<&'a [f64]>,
#[serde(rename = "branchvalues")]
#[serde(skip_serializing_if = "Option::is_none")]
branchvalues: Option<Branchvalues>,
#[serde(rename = "count")]
#[serde(skip_serializing_if = "crate::IsEmpty::is_empty")]
count: crate::IsEmpty<Count>,
#[serde(rename = "level")]
#[serde(skip_serializing_if = "Option::is_none")]
level: Option<crate::Any>,
#[serde(rename = "maxdepth")]
#[serde(skip_serializing_if = "Option::is_none")]
maxdepth: Option<u64>,
#[serde(rename = "tiling")]
#[serde(skip_serializing_if = "crate::IsEmpty::is_empty")]
tiling: crate::IsEmpty<Tiling<>>,
#[serde(rename = "marker")]
#[serde(skip_serializing_if = "crate::IsEmpty::is_empty")]
marker: crate::IsEmpty<Marker<'a>>,
#[serde(rename = "pathbar")]
#[serde(skip_serializing_if = "crate::IsEmpty::is_empty")]
pathbar: crate::IsEmpty<Pathbar<'a>>,
#[serde(rename = "text")]
#[serde(skip_serializing_if = "Option::is_none")]
text: Option<&'a [f64]>,
#[serde(rename = "textinfo")]
#[serde(skip_serializing_if = "crate::IsEmpty::is_empty")]
textinfo: crate::IsEmpty<Textinfo>,
#[serde(rename = "texttemplate")]
#[serde(skip_serializing_if = "Option::is_none")]
texttemplate: Option<&'a str>,
#[serde(rename = "hovertext")]
#[serde(skip_serializing_if = "Option::is_none")]
hovertext: Option<&'a str>,
#[serde(rename = "hoverinfo")]
#[serde(skip_serializing_if = "crate::IsEmpty::is_empty")]
hoverinfo: crate::IsEmpty<Hoverinfo>,
#[serde(rename = "hovertemplate")]
#[serde(skip_serializing_if = "Option::is_none")]
hovertemplate: Option<&'a str>,
#[serde(rename = "textfont")]
#[serde(skip_serializing_if = "crate::IsEmpty::is_empty")]
textfont: crate::IsEmpty<Textfont<'a>>,
#[serde(rename = "insidetextfont")]
#[serde(skip_serializing_if = "crate::IsEmpty::is_empty")]
insidetextfont: crate::IsEmpty<Insidetextfont<'a>>,
#[serde(rename = "outsidetextfont")]
#[serde(skip_serializing_if = "crate::IsEmpty::is_empty")]
outsidetextfont: crate::IsEmpty<Outsidetextfont<'a>>,
#[serde(rename = "textposition")]
#[serde(skip_serializing_if = "Option::is_none")]
textposition: Option<Textposition>,
#[serde(rename = "domain")]
#[serde(skip_serializing_if = "crate::IsEmpty::is_empty")]
domain: crate::IsEmpty<Domain<'a>>,
#[serde(rename = "idssrc")]
#[serde(skip_serializing_if = "Option::is_none")]
idssrc: Option<&'a str>,
#[serde(rename = "customdatasrc")]
#[serde(skip_serializing_if = "Option::is_none")]
customdatasrc: Option<&'a str>,
#[serde(rename = "metasrc")]
#[serde(skip_serializing_if = "Option::is_none")]
metasrc: Option<&'a str>,
#[serde(rename = "labelssrc")]
#[serde(skip_serializing_if = "Option::is_none")]
labelssrc: Option<&'a str>,
#[serde(rename = "parentssrc")]
#[serde(skip_serializing_if = "Option::is_none")]
parentssrc: Option<&'a str>,
#[serde(rename = "valuessrc")]
#[serde(skip_serializing_if = "Option::is_none")]
valuessrc: Option<&'a str>,
#[serde(rename = "textsrc")]
#[serde(skip_serializing_if = "Option::is_none")]
textsrc: Option<&'a str>,
#[serde(rename = "texttemplatesrc")]
#[serde(skip_serializing_if = "Option::is_none")]
texttemplatesrc: Option<&'a str>,
#[serde(rename = "hovertextsrc")]
#[serde(skip_serializing_if = "Option::is_none")]
hovertextsrc: Option<&'a str>,
#[serde(rename = "hoverinfosrc")]
#[serde(skip_serializing_if = "Option::is_none")]
hoverinfosrc: Option<&'a str>,
#[serde(rename = "hovertemplatesrc")]
#[serde(skip_serializing_if = "Option::is_none")]
hovertemplatesrc: Option<&'a str>,
}
impl<'a> Treemap<'a> {
pub fn visible(&mut self, visible: Visible) -> &mut Self {
self.visible = Some(visible);
self
}
pub fn opacity(&mut self, opacity: f64) -> &mut Self {
self.opacity = Some(opacity);
self
}
pub fn name(&mut self, name: &'a str) -> &mut Self {
self.name = Some(name);
self
}
pub fn uid(&mut self, uid: &'a str) -> &mut Self {
self.uid = Some(uid);
self
}
pub fn ids(&mut self, ids: &'a [&'a str]) -> &mut Self {
self.ids = Some(ids);
self
}
pub fn meta(&mut self, meta: crate::Any) -> &mut Self {
self.meta = Some(meta);
self
}
pub fn hoverlabel(&mut self) -> &mut Hoverlabel<'a> {
self.hoverlabel.is_empty = false;
&mut self.hoverlabel.data
}
pub fn stream(&mut self) -> &mut Stream<'a> {
self.stream.is_empty = false;
&mut self.stream.data
}
pub fn uirevision(&mut self, uirevision: crate::Any) -> &mut Self {
self.uirevision = Some(uirevision);
self
}
pub fn labels(&mut self, labels: &'a [f64]) -> &mut Self {
self.labels = Some(labels);
self
}
pub fn parents(&mut self, parents: &'a [f64]) -> &mut Self {
self.parents = Some(parents);
self
}
pub fn values(&mut self, values: &'a [f64]) -> &mut Self {
self.values = Some(values);
self
}
pub fn branchvalues(&mut self, branchvalues: Branchvalues) -> &mut Self {
self.branchvalues = Some(branchvalues);
self
}
pub fn count(&mut self) -> &mut Count {
self.count.is_empty = false;
&mut self.count.data
}
pub fn level(&mut self, level: crate::Any) -> &mut Self {
self.level = Some(level);
self
}
pub fn maxdepth(&mut self, maxdepth: u64) -> &mut Self {
self.maxdepth = Some(maxdepth);
self
}
pub fn tiling(&mut self) -> &mut Tiling<> {
self.tiling.is_empty = false;
&mut self.tiling.data
}
pub fn marker(&mut self) -> &mut Marker<'a> {
self.marker.is_empty = false;
&mut self.marker.data
}
pub fn pathbar(&mut self) -> &mut Pathbar<'a> {
self.pathbar.is_empty = false;
&mut self.pathbar.data
}
pub fn text(&mut self, text: &'a [f64]) -> &mut Self {
self.text = Some(text);
self
}
pub fn textinfo(&mut self) -> &mut Textinfo {
self.textinfo.is_empty = false;
&mut self.textinfo.data
}
pub fn texttemplate(&mut self, texttemplate: &'a str) -> &mut Self {
self.texttemplate = Some(texttemplate);
self
}
pub fn hovertext(&mut self, hovertext: &'a str) -> &mut Self {
self.hovertext = Some(hovertext);
self
}
pub fn hoverinfo(&mut self) -> &mut Hoverinfo {
self.hoverinfo.is_empty = false;
&mut self.hoverinfo.data
}
pub fn hovertemplate(&mut self, hovertemplate: &'a str) -> &mut Self {
self.hovertemplate = Some(hovertemplate);
self
}
pub fn textfont(&mut self) -> &mut Textfont<'a> {
self.textfont.is_empty = false;
&mut self.textfont.data
}
pub fn insidetextfont(&mut self) -> &mut Insidetextfont<'a> {
self.insidetextfont.is_empty = false;
&mut self.insidetextfont.data
}
pub fn outsidetextfont(&mut self) -> &mut Outsidetextfont<'a> {
self.outsidetextfont.is_empty = false;
&mut self.outsidetextfont.data
}
pub fn textposition(&mut self, textposition: Textposition) -> &mut Self {
self.textposition = Some(textposition);
self
}
pub fn domain(&mut self) -> &mut Domain<'a> {
self.domain.is_empty = false;
&mut self.domain.data
}
pub fn idssrc(&mut self, idssrc: &'a str) -> &mut Self {
self.idssrc = Some(idssrc);
self
}
pub fn customdatasrc(&mut self, customdatasrc: &'a str) -> &mut Self {
self.customdatasrc = Some(customdatasrc);
self
}
pub fn metasrc(&mut self, metasrc: &'a str) -> &mut Self {
self.metasrc = Some(metasrc);
self
}
pub fn labelssrc(&mut self, labelssrc: &'a str) -> &mut Self {
self.labelssrc = Some(labelssrc);
self
}
pub fn parentssrc(&mut self, parentssrc: &'a str) -> &mut Self {
self.parentssrc = Some(parentssrc);
self
}
pub fn valuessrc(&mut self, valuessrc: &'a str) -> &mut Self {
self.valuessrc = Some(valuessrc);
self
}
pub fn textsrc(&mut self, textsrc: &'a str) -> &mut Self {
self.textsrc = Some(textsrc);
self
}
pub fn texttemplatesrc(&mut self, texttemplatesrc: &'a str) -> &mut Self {
self.texttemplatesrc = Some(texttemplatesrc);
self
}
pub fn hovertextsrc(&mut self, hovertextsrc: &'a str) -> &mut Self {
self.hovertextsrc = Some(hovertextsrc);
self
}
pub fn hoverinfosrc(&mut self, hoverinfosrc: &'a str) -> &mut Self {
self.hoverinfosrc = Some(hoverinfosrc);
self
}
pub fn hovertemplatesrc(&mut self, hovertemplatesrc: &'a str) -> &mut Self {
self.hovertemplatesrc = Some(hovertemplatesrc);
self
}
}
pub enum Visible {
True,
False,
Legendonly,
}
impl serde::Serialize for Visible {
fn serialize<S: serde::Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {
match self {
Self::True => serializer.serialize_bool(true),
Self::False => serializer.serialize_bool(false),
Self::Legendonly => serializer.serialize_str("legendonly"),
}
}
}
#[derive(Default, Serialize)]
pub struct Hoverlabel<'a> {
#[serde(rename = "bgcolor")]
#[serde(skip_serializing_if = "Option::is_none")]
bgcolor: Option<&'a str>,
#[serde(rename = "bordercolor")]
#[serde(skip_serializing_if = "Option::is_none")]
bordercolor: Option<&'a str>,
#[serde(rename = "font")]
#[serde(skip_serializing_if = "crate::IsEmpty::is_empty")]
font: crate::IsEmpty<hoverlabel::Font<'a>>,
#[serde(rename = "align")]
#[serde(skip_serializing_if = "Option::is_none")]
align: Option<hoverlabel::Align>,
#[serde(rename = "namelength")]
#[serde(skip_serializing_if = "Option::is_none")]
namelength: Option<u64>,
}
impl<'a> Hoverlabel<'a> {
pub fn bgcolor(&mut self, bgcolor: &'a str) -> &mut Self {
self.bgcolor = Some(bgcolor);
self
}
pub fn bordercolor(&mut self, bordercolor: &'a str) -> &mut Self {
self.bordercolor = Some(bordercolor);
self
}
pub fn font(&mut self) -> &mut hoverlabel::Font<'a> {
self.font.is_empty = false;
&mut self.font.data
}
pub fn align(&mut self, align: hoverlabel::Align) -> &mut Self {
self.align = Some(align);
self
}
pub fn namelength(&mut self, namelength: u64) -> &mut Self {
self.namelength = Some(namelength);
self
}
}
pub mod hoverlabel {
#[allow(unused_imports)]
use serde::Serialize;
#[derive(Default, Serialize)]
pub struct Font<'a> {
#[serde(rename = "family")]
#[serde(skip_serializing_if = "Option::is_none")]
family: Option<&'a str>,
#[serde(rename = "size")]
#[serde(skip_serializing_if = "Option::is_none")]
size: Option<f64>,
#[serde(rename = "color")]
#[serde(skip_serializing_if = "Option::is_none")]
color: Option<&'a str>,
}
impl<'a> Font<'a> {
pub fn family(&mut self, family: &'a str) -> &mut Self {
self.family = Some(family);
self
}
pub fn size(&mut self, size: f64) -> &mut Self {
self.size = Some(size);
self
}
pub fn color(&mut self, color: &'a str) -> &mut Self {
self.color = Some(color);
self
}
}
pub enum Align {
Left,
Right,
Auto,
}
impl serde::Serialize for Align {
fn serialize<S: serde::Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {
match self {
Self::Left => serializer.serialize_str("left"),
Self::Right => serializer.serialize_str("right"),
Self::Auto => serializer.serialize_str("auto"),
}
}
}
}
#[derive(Default, Serialize)]
pub struct Stream<'a> {
#[serde(rename = "token")]
#[serde(skip_serializing_if = "Option::is_none")]
token: Option<&'a str>,
#[serde(rename = "maxpoints")]
#[serde(skip_serializing_if = "Option::is_none")]
maxpoints: Option<f64>,
}
impl<'a> Stream<'a> {
pub fn token(&mut self, token: &'a str) -> &mut Self {
self.token = Some(token);
self
}
pub fn maxpoints(&mut self, maxpoints: f64) -> &mut Self {
self.maxpoints = Some(maxpoints);
self
}
}
pub enum Branchvalues {
Remainder,
Total,
}
impl serde::Serialize for Branchvalues {
fn serialize<S: serde::Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {
match self {
Self::Remainder => serializer.serialize_str("remainder"),
Self::Total => serializer.serialize_str("total"),
}
}
}
#[derive(Default)]
pub struct CountFlags ([u8; 1]);
impl CountFlags {
pub fn branches(&mut self, v: bool) -> &mut Self {
if v { self.0[0] |= 1 << 0; }
else { self.0[0] &= !(1 << 0); }
self
}
pub fn leaves(&mut self, v: bool) -> &mut Self {
if v { self.0[0] |= 1 << 1; }
else { self.0[0] &= !(1 << 1); }
self
}
}
impl serde::Serialize for CountFlags {
fn serialize<S: serde::Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {
#[allow(unused_mut)]
let mut v: Vec<&str> = Vec::new();
if (self.0[0] >> 0) & 0x1 == 1 {
v.push("branches");
}
if (self.0[0] >> 1) & 0x1 == 1 {
v.push("leaves");
}
serializer.serialize_str(&v.join("+"))
}
}
pub enum Count {
Flags(CountFlags),
}
impl serde::Serialize for Count {
fn serialize<S: serde::Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {
match self {
Self::Flags(v) => v.serialize(serializer),
}
}
}
impl Default for Count {
fn default() -> Self {
Self::Flags(CountFlags::default())
}
}
impl Count {
pub fn flags(&mut self) -> &mut CountFlags {
*self = Self::Flags(CountFlags::default());
match self {
Self::Flags(v) => v,
}
}
pub fn set(&mut self, v: Count) {
*self = v;
}
}
#[derive(Default, Serialize)]
pub struct Tiling<> {
#[serde(rename = "packing")]
#[serde(skip_serializing_if = "Option::is_none")]
packing: Option<tiling::Packing>,
#[serde(rename = "squarifyratio")]
#[serde(skip_serializing_if = "Option::is_none")]
squarifyratio: Option<f64>,
#[serde(rename = "flip")]
#[serde(skip_serializing_if = "crate::IsEmpty::is_empty")]
flip: crate::IsEmpty<tiling::Flip>,
#[serde(rename = "pad")]
#[serde(skip_serializing_if = "Option::is_none")]
pad: Option<f64>,
}
impl<> Tiling<> {
pub fn packing(&mut self, packing: tiling::Packing) -> &mut Self {
self.packing = Some(packing);
self
}
pub fn squarifyratio(&mut self, squarifyratio: f64) -> &mut Self {
self.squarifyratio = Some(squarifyratio);
self
}
pub fn flip(&mut self) -> &mut tiling::Flip {
self.flip.is_empty = false;
&mut self.flip.data
}
pub fn pad(&mut self, pad: f64) -> &mut Self {
self.pad = Some(pad);
self
}
}
pub mod tiling {
#[allow(unused_imports)]
use serde::Serialize;
pub enum Packing {
Squarify,
Binary,
Dice,
Slice,
SliceDice,
DiceSlice,
}
impl serde::Serialize for Packing {
fn serialize<S: serde::Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {
match self {
Self::Squarify => serializer.serialize_str("squarify"),
Self::Binary => serializer.serialize_str("binary"),
Self::Dice => serializer.serialize_str("dice"),
Self::Slice => serializer.serialize_str("slice"),
Self::SliceDice => serializer.serialize_str("slice-dice"),
Self::DiceSlice => serializer.serialize_str("dice-slice"),
}
}
}
#[derive(Default)]
pub struct FlipFlags ([u8; 1]);
impl FlipFlags {
pub fn x(&mut self, v: bool) -> &mut Self {
if v { self.0[0] |= 1 << 0; }
else { self.0[0] &= !(1 << 0); }
self
}
pub fn y(&mut self, v: bool) -> &mut Self {
if v { self.0[0] |= 1 << 1; }
else { self.0[0] &= !(1 << 1); }
self
}
}
impl serde::Serialize for FlipFlags {
fn serialize<S: serde::Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {
#[allow(unused_mut)]
let mut v: Vec<&str> = Vec::new();
if (self.0[0] >> 0) & 0x1 == 1 {
v.push("x");
}
if (self.0[0] >> 1) & 0x1 == 1 {
v.push("y");
}
serializer.serialize_str(&v.join("+"))
}
}
pub enum Flip {
Flags(FlipFlags),
}
impl serde::Serialize for Flip {
fn serialize<S: serde::Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {
match self {
Self::Flags(v) => v.serialize(serializer),
}
}
}
impl Default for Flip {
fn default() -> Self {
Self::Flags(FlipFlags::default())
}
}
impl Flip {
pub fn flags(&mut self) -> &mut FlipFlags {
*self = Self::Flags(FlipFlags::default());
match self {
Self::Flags(v) => v,
}
}
pub fn set(&mut self, v: Flip) {
*self = v;
}
}
}
#[derive(Default, Serialize)]
pub struct Marker<'a> {
#[serde(rename = "pad")]
#[serde(skip_serializing_if = "crate::IsEmpty::is_empty")]
pad: crate::IsEmpty<marker::Pad<>>,
#[serde(rename = "colors")]
#[serde(skip_serializing_if = "Option::is_none")]
colors: Option<&'a [f64]>,
#[serde(rename = "depthfade")]
#[serde(skip_serializing_if = "Option::is_none")]
depthfade: Option<marker::Depthfade>,
#[serde(rename = "line")]
#[serde(skip_serializing_if = "crate::IsEmpty::is_empty")]
line: crate::IsEmpty<marker::Line<'a>>,
#[serde(rename = "cauto")]
#[serde(skip_serializing_if = "Option::is_none")]
cauto: Option<bool>,
#[serde(rename = "cmin")]
#[serde(skip_serializing_if = "Option::is_none")]
cmin: Option<f64>,
#[serde(rename = "cmax")]
#[serde(skip_serializing_if = "Option::is_none")]
cmax: Option<f64>,
#[serde(rename = "cmid")]
#[serde(skip_serializing_if = "Option::is_none")]
cmid: Option<f64>,
#[serde(rename = "colorscale")]
#[serde(skip_serializing_if = "Option::is_none")]
colorscale: Option<crate::ColorScale<'a>>,
#[serde(rename = "autocolorscale")]
#[serde(skip_serializing_if = "Option::is_none")]
autocolorscale: Option<bool>,
#[serde(rename = "reversescale")]
#[serde(skip_serializing_if = "Option::is_none")]
reversescale: Option<bool>,
#[serde(rename = "showscale")]
#[serde(skip_serializing_if = "Option::is_none")]
showscale: Option<bool>,
#[serde(rename = "colorbar")]
#[serde(skip_serializing_if = "crate::IsEmpty::is_empty")]
colorbar: crate::IsEmpty<marker::Colorbar<'a>>,
#[serde(rename = "coloraxis")]
#[serde(skip_serializing_if = "Option::is_none")]
coloraxis: Option<&'a str>,
}
impl<'a> Marker<'a> {
pub fn pad(&mut self) -> &mut marker::Pad<> {
self.pad.is_empty = false;
&mut self.pad.data
}
pub fn colors(&mut self, colors: &'a [f64]) -> &mut Self {
self.colors = Some(colors);
self
}
pub fn depthfade(&mut self, depthfade: marker::Depthfade) -> &mut Self {
self.depthfade = Some(depthfade);
self
}
pub fn line(&mut self) -> &mut marker::Line<'a> {
self.line.is_empty = false;
&mut self.line.data
}
pub fn cauto(&mut self, cauto: bool) -> &mut Self {
self.cauto = Some(cauto);
self
}
pub fn cmin(&mut self, cmin: f64) -> &mut Self {
self.cmin = Some(cmin);
self
}
pub fn cmax(&mut self, cmax: f64) -> &mut Self {
self.cmax = Some(cmax);
self
}
pub fn cmid(&mut self, cmid: f64) -> &mut Self {
self.cmid = Some(cmid);
self
}
pub fn colorscale(&mut self, colorscale: crate::ColorScale<'a>) -> &mut Self {
self.colorscale = Some(colorscale);
self
}
pub fn autocolorscale(&mut self, autocolorscale: bool) -> &mut Self {
self.autocolorscale = Some(autocolorscale);
self
}
pub fn reversescale(&mut self, reversescale: bool) -> &mut Self {
self.reversescale = Some(reversescale);
self
}
pub fn showscale(&mut self, showscale: bool) -> &mut Self {
self.showscale = Some(showscale);
self
}
pub fn colorbar(&mut self) -> &mut marker::Colorbar<'a> {
self.colorbar.is_empty = false;
&mut self.colorbar.data
}
pub fn coloraxis(&mut self, coloraxis: &'a str) -> &mut Self {
self.coloraxis = Some(coloraxis);
self
}
}
pub mod marker {
#[allow(unused_imports)]
use serde::Serialize;
#[derive(Default, Serialize)]
pub struct Pad<> {
#[serde(rename = "t")]
#[serde(skip_serializing_if = "Option::is_none")]
t: Option<f64>,
#[serde(rename = "l")]
#[serde(skip_serializing_if = "Option::is_none")]
l: Option<f64>,
#[serde(rename = "r")]
#[serde(skip_serializing_if = "Option::is_none")]
r: Option<f64>,
#[serde(rename = "b")]
#[serde(skip_serializing_if = "Option::is_none")]
b: Option<f64>,
}
impl<> Pad<> {
pub fn t(&mut self, t: f64) -> &mut Self {
self.t = Some(t);
self
}
pub fn l(&mut self, l: f64) -> &mut Self {
self.l = Some(l);
self
}
pub fn r(&mut self, r: f64) -> &mut Self {
self.r = Some(r);
self
}
pub fn b(&mut self, b: f64) -> &mut Self {
self.b = Some(b);
self
}
}
pub enum Depthfade {
True,
False,
Reversed,
}
impl serde::Serialize for Depthfade {
fn serialize<S: serde::Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {
match self {
Self::True => serializer.serialize_bool(true),
Self::False => serializer.serialize_bool(false),
Self::Reversed => serializer.serialize_str("reversed"),
}
}
}
#[derive(Default, Serialize)]
pub struct Line<'a> {
#[serde(rename = "color")]
#[serde(skip_serializing_if = "Option::is_none")]
color: Option<&'a str>,
#[serde(rename = "width")]
#[serde(skip_serializing_if = "Option::is_none")]
width: Option<f64>,
}
impl<'a> Line<'a> {
pub fn color(&mut self, color: &'a str) -> &mut Self {
self.color = Some(color);
self
}
pub fn width(&mut self, width: f64) -> &mut Self {
self.width = Some(width);
self
}
}
#[derive(Default, Serialize)]
pub struct Colorbar<'a> {
#[serde(rename = "thicknessmode")]
#[serde(skip_serializing_if = "Option::is_none")]
thicknessmode: Option<colorbar::Thicknessmode>,
#[serde(rename = "thickness")]
#[serde(skip_serializing_if = "Option::is_none")]
thickness: Option<f64>,
#[serde(rename = "lenmode")]
#[serde(skip_serializing_if = "Option::is_none")]
lenmode: Option<colorbar::Lenmode>,
#[serde(rename = "len")]
#[serde(skip_serializing_if = "Option::is_none")]
len: Option<f64>,
#[serde(rename = "x")]
#[serde(skip_serializing_if = "Option::is_none")]
x: Option<f64>,
#[serde(rename = "xanchor")]
#[serde(skip_serializing_if = "Option::is_none")]
xanchor: Option<colorbar::Xanchor>,
#[serde(rename = "xpad")]
#[serde(skip_serializing_if = "Option::is_none")]
xpad: Option<f64>,
#[serde(rename = "y")]
#[serde(skip_serializing_if = "Option::is_none")]
y: Option<f64>,
#[serde(rename = "yanchor")]
#[serde(skip_serializing_if = "Option::is_none")]
yanchor: Option<colorbar::Yanchor>,
#[serde(rename = "ypad")]
#[serde(skip_serializing_if = "Option::is_none")]
ypad: Option<f64>,
#[serde(rename = "outlinecolor")]
#[serde(skip_serializing_if = "Option::is_none")]
outlinecolor: Option<&'a str>,
#[serde(rename = "outlinewidth")]
#[serde(skip_serializing_if = "Option::is_none")]
outlinewidth: Option<f64>,
#[serde(rename = "bordercolor")]
#[serde(skip_serializing_if = "Option::is_none")]
bordercolor: Option<&'a str>,
#[serde(rename = "borderwidth")]
#[serde(skip_serializing_if = "Option::is_none")]
borderwidth: Option<f64>,
#[serde(rename = "bgcolor")]
#[serde(skip_serializing_if = "Option::is_none")]
bgcolor: Option<&'a str>,
#[serde(rename = "tickmode")]
#[serde(skip_serializing_if = "Option::is_none")]
tickmode: Option<colorbar::Tickmode>,
#[serde(rename = "nticks")]
#[serde(skip_serializing_if = "Option::is_none")]
nticks: Option<u64>,
#[serde(rename = "tick0")]
#[serde(skip_serializing_if = "Option::is_none")]
tick_0: Option<crate::Any>,
#[serde(rename = "dtick")]
#[serde(skip_serializing_if = "Option::is_none")]
dtick: Option<crate::Any>,
#[serde(rename = "tickvals")]
#[serde(skip_serializing_if = "Option::is_none")]
tickvals: Option<&'a [f64]>,
#[serde(rename = "ticktext")]
#[serde(skip_serializing_if = "Option::is_none")]
ticktext: Option<&'a [&'a str]>,
#[serde(rename = "ticks")]
#[serde(skip_serializing_if = "Option::is_none")]
ticks: Option<colorbar::Ticks>,
#[serde(rename = "ticklen")]
#[serde(skip_serializing_if = "Option::is_none")]
ticklen: Option<f64>,
#[serde(rename = "tickwidth")]
#[serde(skip_serializing_if = "Option::is_none")]
tickwidth: Option<f64>,
#[serde(rename = "tickcolor")]
#[serde(skip_serializing_if = "Option::is_none")]
tickcolor: Option<&'a str>,
#[serde(rename = "showticklabels")]
#[serde(skip_serializing_if = "Option::is_none")]
showticklabels: Option<bool>,
#[serde(rename = "tickfont")]
#[serde(skip_serializing_if = "crate::IsEmpty::is_empty")]
tickfont: crate::IsEmpty<colorbar::Tickfont<'a>>,
#[serde(rename = "tickangle")]
#[serde(skip_serializing_if = "Option::is_none")]
tickangle: Option<crate::Angle>,
#[serde(rename = "tickformat")]
#[serde(skip_serializing_if = "Option::is_none")]
tickformat: Option<&'a str>,
#[serde(rename = "tickprefix")]
#[serde(skip_serializing_if = "Option::is_none")]
tickprefix: Option<&'a str>,
#[serde(rename = "showtickprefix")]
#[serde(skip_serializing_if = "Option::is_none")]
showtickprefix: Option<colorbar::Showtickprefix>,
#[serde(rename = "ticksuffix")]
#[serde(skip_serializing_if = "Option::is_none")]
ticksuffix: Option<&'a str>,
#[serde(rename = "showticksuffix")]
#[serde(skip_serializing_if = "Option::is_none")]
showticksuffix: Option<colorbar::Showticksuffix>,
#[serde(rename = "separatethousands")]
#[serde(skip_serializing_if = "Option::is_none")]
separatethousands: Option<bool>,
#[serde(rename = "exponentformat")]
#[serde(skip_serializing_if = "Option::is_none")]
exponentformat: Option<colorbar::Exponentformat>,
#[serde(rename = "showexponent")]
#[serde(skip_serializing_if = "Option::is_none")]
showexponent: Option<colorbar::Showexponent>,
#[serde(rename = "title")]
#[serde(skip_serializing_if = "crate::IsEmpty::is_empty")]
title: crate::IsEmpty<colorbar::Title<'a>>,
}
impl<'a> Colorbar<'a> {
pub fn thicknessmode(&mut self, thicknessmode: colorbar::Thicknessmode) -> &mut Self {
self.thicknessmode = Some(thicknessmode);
self
}
pub fn thickness(&mut self, thickness: f64) -> &mut Self {
self.thickness = Some(thickness);
self
}
pub fn lenmode(&mut self, lenmode: colorbar::Lenmode) -> &mut Self {
self.lenmode = Some(lenmode);
self
}
pub fn len(&mut self, len: f64) -> &mut Self {
self.len = Some(len);
self
}
pub fn x(&mut self, x: f64) -> &mut Self {
self.x = Some(x);
self
}
pub fn xanchor(&mut self, xanchor: colorbar::Xanchor) -> &mut Self {
self.xanchor = Some(xanchor);
self
}
pub fn xpad(&mut self, xpad: f64) -> &mut Self {
self.xpad = Some(xpad);
self
}
pub fn y(&mut self, y: f64) -> &mut Self {
self.y = Some(y);
self
}
pub fn yanchor(&mut self, yanchor: colorbar::Yanchor) -> &mut Self {
self.yanchor = Some(yanchor);
self
}
pub fn ypad(&mut self, ypad: f64) -> &mut Self {
self.ypad = Some(ypad);
self
}
pub fn outlinecolor(&mut self, outlinecolor: &'a str) -> &mut Self {
self.outlinecolor = Some(outlinecolor);
self
}
pub fn outlinewidth(&mut self, outlinewidth: f64) -> &mut Self {
self.outlinewidth = Some(outlinewidth);
self
}
pub fn bordercolor(&mut self, bordercolor: &'a str) -> &mut Self {
self.bordercolor = Some(bordercolor);
self
}
pub fn borderwidth(&mut self, borderwidth: f64) -> &mut Self {
self.borderwidth = Some(borderwidth);
self
}
pub fn bgcolor(&mut self, bgcolor: &'a str) -> &mut Self {
self.bgcolor = Some(bgcolor);
self
}
pub fn tickmode(&mut self, tickmode: colorbar::Tickmode) -> &mut Self {
self.tickmode = Some(tickmode);
self
}
pub fn nticks(&mut self, nticks: u64) -> &mut Self {
self.nticks = Some(nticks);
self
}
pub fn tick_0(&mut self, tick_0: crate::Any) -> &mut Self {
self.tick_0 = Some(tick_0);
self
}
pub fn dtick(&mut self, dtick: crate::Any) -> &mut Self {
self.dtick = Some(dtick);
self
}
pub fn tickvals(&mut self, tickvals: &'a [f64]) -> &mut Self {
self.tickvals = Some(tickvals);
self
}
pub fn ticktext(&mut self, ticktext: &'a [&'a str]) -> &mut Self {
self.ticktext = Some(ticktext);
self
}
pub fn ticks(&mut self, ticks: colorbar::Ticks) -> &mut Self {
self.ticks = Some(ticks);
self
}
pub fn ticklen(&mut self, ticklen: f64) -> &mut Self {
self.ticklen = Some(ticklen);
self
}
pub fn tickwidth(&mut self, tickwidth: f64) -> &mut Self {
self.tickwidth = Some(tickwidth);
self
}
pub fn tickcolor(&mut self, tickcolor: &'a str) -> &mut Self {
self.tickcolor = Some(tickcolor);
self
}
pub fn showticklabels(&mut self, showticklabels: bool) -> &mut Self {
self.showticklabels = Some(showticklabels);
self
}
pub fn tickfont(&mut self) -> &mut colorbar::Tickfont<'a> {
self.tickfont.is_empty = false;
&mut self.tickfont.data
}
pub fn tickangle(&mut self, tickangle: crate::Angle) -> &mut Self {
self.tickangle = Some(tickangle);
self
}
pub fn tickformat(&mut self, tickformat: &'a str) -> &mut Self {
self.tickformat = Some(tickformat);
self
}
pub fn tickprefix(&mut self, tickprefix: &'a str) -> &mut Self {
self.tickprefix = Some(tickprefix);
self
}
pub fn showtickprefix(&mut self, showtickprefix: colorbar::Showtickprefix) -> &mut Self {
self.showtickprefix = Some(showtickprefix);
self
}
pub fn ticksuffix(&mut self, ticksuffix: &'a str) -> &mut Self {
self.ticksuffix = Some(ticksuffix);
self
}
pub fn showticksuffix(&mut self, showticksuffix: colorbar::Showticksuffix) -> &mut Self {
self.showticksuffix = Some(showticksuffix);
self
}
pub fn separatethousands(&mut self, separatethousands: bool) -> &mut Self {
self.separatethousands = Some(separatethousands);
self
}
pub fn exponentformat(&mut self, exponentformat: colorbar::Exponentformat) -> &mut Self {
self.exponentformat = Some(exponentformat);
self
}
pub fn showexponent(&mut self, showexponent: colorbar::Showexponent) -> &mut Self {
self.showexponent = Some(showexponent);
self
}
pub fn title(&mut self) -> &mut colorbar::Title<'a> {
self.title.is_empty = false;
&mut self.title.data
}
}
pub mod colorbar {
#[allow(unused_imports)]
use serde::Serialize;
pub enum Thicknessmode {
Fraction,
Pixels,
}
impl serde::Serialize for Thicknessmode {
fn serialize<S: serde::Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {
match self {
Self::Fraction => serializer.serialize_str("fraction"),
Self::Pixels => serializer.serialize_str("pixels"),
}
}
}
pub enum Lenmode {
Fraction,
Pixels,
}
impl serde::Serialize for Lenmode {
fn serialize<S: serde::Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {
match self {
Self::Fraction => serializer.serialize_str("fraction"),
Self::Pixels => serializer.serialize_str("pixels"),
}
}
}
pub enum Xanchor {
Left,
Center,
Right,
}
impl serde::Serialize for Xanchor {
fn serialize<S: serde::Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {
match self {
Self::Left => serializer.serialize_str("left"),
Self::Center => serializer.serialize_str("center"),
Self::Right => serializer.serialize_str("right"),
}
}
}
pub enum Yanchor {
Top,
Middle,
Bottom,
}
impl serde::Serialize for Yanchor {
fn serialize<S: serde::Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {
match self {
Self::Top => serializer.serialize_str("top"),
Self::Middle => serializer.serialize_str("middle"),
Self::Bottom => serializer.serialize_str("bottom"),
}
}
}
pub enum Tickmode {
Auto,
Linear,
Array,
}
impl serde::Serialize for Tickmode {
fn serialize<S: serde::Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {
match self {
Self::Auto => serializer.serialize_str("auto"),
Self::Linear => serializer.serialize_str("linear"),
Self::Array => serializer.serialize_str("array"),
}
}
}
pub enum Ticks {
Outside,
Inside,
}
impl serde::Serialize for Ticks {
fn serialize<S: serde::Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {
match self {
Self::Outside => serializer.serialize_str("outside"),
Self::Inside => serializer.serialize_str("inside"),
}
}
}
#[derive(Default, Serialize)]
pub struct Tickfont<'a> {
#[serde(rename = "family")]
#[serde(skip_serializing_if = "Option::is_none")]
family: Option<&'a str>,
#[serde(rename = "size")]
#[serde(skip_serializing_if = "Option::is_none")]
size: Option<f64>,
#[serde(rename = "color")]
#[serde(skip_serializing_if = "Option::is_none")]
color: Option<&'a str>,
}
impl<'a> Tickfont<'a> {
pub fn family(&mut self, family: &'a str) -> &mut Self {
self.family = Some(family);
self
}
pub fn size(&mut self, size: f64) -> &mut Self {
self.size = Some(size);
self
}
pub fn color(&mut self, color: &'a str) -> &mut Self {
self.color = Some(color);
self
}
}
pub enum Showtickprefix {
All,
First,
Last,
None,
}
impl serde::Serialize for Showtickprefix {
fn serialize<S: serde::Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {
match self {
Self::All => serializer.serialize_str("all"),
Self::First => serializer.serialize_str("first"),
Self::Last => serializer.serialize_str("last"),
Self::None => serializer.serialize_str("none"),
}
}
}
pub enum Showticksuffix {
All,
First,
Last,
None,
}
impl serde::Serialize for Showticksuffix {
fn serialize<S: serde::Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {
match self {
Self::All => serializer.serialize_str("all"),
Self::First => serializer.serialize_str("first"),
Self::Last => serializer.serialize_str("last"),
Self::None => serializer.serialize_str("none"),
}
}
}
pub enum Exponentformat {
None,
SmallE,
BigE,
Power,
Si,
B,
}
impl serde::Serialize for Exponentformat {
fn serialize<S: serde::Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {
match self {
Self::None => serializer.serialize_str("none"),
Self::SmallE => serializer.serialize_str("e"),
Self::BigE => serializer.serialize_str("E"),
Self::Power => serializer.serialize_str("power"),
Self::Si => serializer.serialize_str("SI"),
Self::B => serializer.serialize_str("B"),
}
}
}
pub enum Showexponent {
All,
First,
Last,
None,
}
impl serde::Serialize for Showexponent {
fn serialize<S: serde::Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {
match self {
Self::All => serializer.serialize_str("all"),
Self::First => serializer.serialize_str("first"),
Self::Last => serializer.serialize_str("last"),
Self::None => serializer.serialize_str("none"),
}
}
}
#[derive(Default, Serialize)]
pub struct Title<'a> {
#[serde(rename = "text")]
#[serde(skip_serializing_if = "Option::is_none")]
text: Option<&'a str>,
#[serde(rename = "font")]
#[serde(skip_serializing_if = "crate::IsEmpty::is_empty")]
font: crate::IsEmpty<title::Font<'a>>,
#[serde(rename = "side")]
#[serde(skip_serializing_if = "Option::is_none")]
side: Option<title::Side>,
}
impl<'a> Title<'a> {
pub fn text(&mut self, text: &'a str) -> &mut Self {
self.text = Some(text);
self
}
pub fn font(&mut self) -> &mut title::Font<'a> {
self.font.is_empty = false;
&mut self.font.data
}
pub fn side(&mut self, side: title::Side) -> &mut Self {
self.side = Some(side);
self
}
}
pub mod title {
#[allow(unused_imports)]
use serde::Serialize;
#[derive(Default, Serialize)]
pub struct Font<'a> {
#[serde(rename = "family")]
#[serde(skip_serializing_if = "Option::is_none")]
family: Option<&'a str>,
#[serde(rename = "size")]
#[serde(skip_serializing_if = "Option::is_none")]
size: Option<f64>,
#[serde(rename = "color")]
#[serde(skip_serializing_if = "Option::is_none")]
color: Option<&'a str>,
}
impl<'a> Font<'a> {
pub fn family(&mut self, family: &'a str) -> &mut Self {
self.family = Some(family);
self
}
pub fn size(&mut self, size: f64) -> &mut Self {
self.size = Some(size);
self
}
pub fn color(&mut self, color: &'a str) -> &mut Self {
self.color = Some(color);
self
}
}
pub enum Side {
Right,
Top,
Bottom,
}
impl serde::Serialize for Side {
fn serialize<S: serde::Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {
match self {
Self::Right => serializer.serialize_str("right"),
Self::Top => serializer.serialize_str("top"),
Self::Bottom => serializer.serialize_str("bottom"),
}
}
}
}
}
}
#[derive(Default, Serialize)]
pub struct Pathbar<'a> {
#[serde(rename = "visible")]
#[serde(skip_serializing_if = "Option::is_none")]
visible: Option<bool>,
#[serde(rename = "side")]
#[serde(skip_serializing_if = "Option::is_none")]
side: Option<pathbar::Side>,
#[serde(rename = "edgeshape")]
#[serde(skip_serializing_if = "Option::is_none")]
edgeshape: Option<pathbar::Edgeshape>,
#[serde(rename = "thickness")]
#[serde(skip_serializing_if = "Option::is_none")]
thickness: Option<f64>,
#[serde(rename = "textfont")]
#[serde(skip_serializing_if = "crate::IsEmpty::is_empty")]
textfont: crate::IsEmpty<pathbar::Textfont<'a>>,
}
impl<'a> Pathbar<'a> {
pub fn visible(&mut self, visible: bool) -> &mut Self {
self.visible = Some(visible);
self
}
pub fn side(&mut self, side: pathbar::Side) -> &mut Self {
self.side = Some(side);
self
}
pub fn edgeshape(&mut self, edgeshape: pathbar::Edgeshape) -> &mut Self {
self.edgeshape = Some(edgeshape);
self
}
pub fn thickness(&mut self, thickness: f64) -> &mut Self {
self.thickness = Some(thickness);
self
}
pub fn textfont(&mut self) -> &mut pathbar::Textfont<'a> {
self.textfont.is_empty = false;
&mut self.textfont.data
}
}
pub mod pathbar {
#[allow(unused_imports)]
use serde::Serialize;
pub enum Side {
Top,
Bottom,
}
impl serde::Serialize for Side {
fn serialize<S: serde::Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {
match self {
Self::Top => serializer.serialize_str("top"),
Self::Bottom => serializer.serialize_str("bottom"),
}
}
}
pub enum Edgeshape {
Gt,
Lt,
Or,
Slash,
Backslash,
}
impl serde::Serialize for Edgeshape {
fn serialize<S: serde::Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {
match self {
Self::Gt => serializer.serialize_str(">"),
Self::Lt => serializer.serialize_str("<"),
Self::Or => serializer.serialize_str("|"),
Self::Slash => serializer.serialize_str("/"),
Self::Backslash => serializer.serialize_str("\\"),
}
}
}
#[derive(Default, Serialize)]
pub struct Textfont<'a> {
#[serde(rename = "family")]
#[serde(skip_serializing_if = "Option::is_none")]
family: Option<&'a str>,
#[serde(rename = "size")]
#[serde(skip_serializing_if = "Option::is_none")]
size: Option<f64>,
#[serde(rename = "color")]
#[serde(skip_serializing_if = "Option::is_none")]
color: Option<&'a str>,
}
impl<'a> Textfont<'a> {
pub fn family(&mut self, family: &'a str) -> &mut Self {
self.family = Some(family);
self
}
pub fn size(&mut self, size: f64) -> &mut Self {
self.size = Some(size);
self
}
pub fn color(&mut self, color: &'a str) -> &mut Self {
self.color = Some(color);
self
}
}
}
#[derive(Default)]
pub struct TextinfoFlags ([u8; 1]);
impl TextinfoFlags {
pub fn label(&mut self, v: bool) -> &mut Self {
if v { self.0[0] |= 1 << 0; }
else { self.0[0] &= !(1 << 0); }
self
}
pub fn text(&mut self, v: bool) -> &mut Self {
if v { self.0[0] |= 1 << 1; }
else { self.0[0] &= !(1 << 1); }
self
}
pub fn value(&mut self, v: bool) -> &mut Self {
if v { self.0[0] |= 1 << 2; }
else { self.0[0] &= !(1 << 2); }
self
}
pub fn current_path(&mut self, v: bool) -> &mut Self {
if v { self.0[0] |= 1 << 3; }
else { self.0[0] &= !(1 << 3); }
self
}
pub fn percent_root(&mut self, v: bool) -> &mut Self {
if v { self.0[0] |= 1 << 4; }
else { self.0[0] &= !(1 << 4); }
self
}
pub fn percent_entry(&mut self, v: bool) -> &mut Self {
if v { self.0[0] |= 1 << 5; }
else { self.0[0] &= !(1 << 5); }
self
}
pub fn percent_parent(&mut self, v: bool) -> &mut Self {
if v { self.0[0] |= 1 << 6; }
else { self.0[0] &= !(1 << 6); }
self
}
}
impl serde::Serialize for TextinfoFlags {
fn serialize<S: serde::Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {
#[allow(unused_mut)]
let mut v: Vec<&str> = Vec::new();
if (self.0[0] >> 0) & 0x1 == 1 {
v.push("label");
}
if (self.0[0] >> 1) & 0x1 == 1 {
v.push("text");
}
if (self.0[0] >> 2) & 0x1 == 1 {
v.push("value");
}
if (self.0[0] >> 3) & 0x1 == 1 {
v.push("current path");
}
if (self.0[0] >> 4) & 0x1 == 1 {
v.push("percent root");
}
if (self.0[0] >> 5) & 0x1 == 1 {
v.push("percent entry");
}
if (self.0[0] >> 6) & 0x1 == 1 {
v.push("percent parent");
}
serializer.serialize_str(&v.join("+"))
}
}
pub enum Textinfo {
Flags(TextinfoFlags),
None,
}
impl serde::Serialize for Textinfo {
fn serialize<S: serde::Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {
match self {
Self::None => serializer.serialize_str("none"),
Self::Flags(v) => v.serialize(serializer),
}
}
}
impl Default for Textinfo {
fn default() -> Self {
Self::Flags(TextinfoFlags::default())
}
}
impl Textinfo {
pub fn flags(&mut self) -> &mut TextinfoFlags {
*self = Self::Flags(TextinfoFlags::default());
match self {
Self::Flags(v) => v,
_ => unreachable!(),
}
}
pub fn set(&mut self, v: Textinfo) {
*self = v;
}
}
#[derive(Default)]
pub struct HoverinfoFlags ([u8; 1]);
impl HoverinfoFlags {
pub fn label(&mut self, v: bool) -> &mut Self {
if v { self.0[0] |= 1 << 0; }
else { self.0[0] &= !(1 << 0); }
self
}
pub fn text(&mut self, v: bool) -> &mut Self {
if v { self.0[0] |= 1 << 1; }
else { self.0[0] &= !(1 << 1); }
self
}
pub fn value(&mut self, v: bool) -> &mut Self {
if v { self.0[0] |= 1 << 2; }
else { self.0[0] &= !(1 << 2); }
self
}
pub fn name(&mut self, v: bool) -> &mut Self {
if v { self.0[0] |= 1 << 3; }
else { self.0[0] &= !(1 << 3); }
self
}
pub fn current_path(&mut self, v: bool) -> &mut Self {
if v { self.0[0] |= 1 << 4; }
else { self.0[0] &= !(1 << 4); }
self
}
pub fn percent_root(&mut self, v: bool) -> &mut Self {
if v { self.0[0] |= 1 << 5; }
else { self.0[0] &= !(1 << 5); }
self
}
pub fn percent_entry(&mut self, v: bool) -> &mut Self {
if v { self.0[0] |= 1 << 6; }
else { self.0[0] &= !(1 << 6); }
self
}
pub fn percent_parent(&mut self, v: bool) -> &mut Self {
if v { self.0[0] |= 1 << 7; }
else { self.0[0] &= !(1 << 7); }
self
}
}
impl serde::Serialize for HoverinfoFlags {
fn serialize<S: serde::Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {
#[allow(unused_mut)]
let mut v: Vec<&str> = Vec::new();
if (self.0[0] >> 0) & 0x1 == 1 {
v.push("label");
}
if (self.0[0] >> 1) & 0x1 == 1 {
v.push("text");
}
if (self.0[0] >> 2) & 0x1 == 1 {
v.push("value");
}
if (self.0[0] >> 3) & 0x1 == 1 {
v.push("name");
}
if (self.0[0] >> 4) & 0x1 == 1 {
v.push("current path");
}
if (self.0[0] >> 5) & 0x1 == 1 {
v.push("percent root");
}
if (self.0[0] >> 6) & 0x1 == 1 {
v.push("percent entry");
}
if (self.0[0] >> 7) & 0x1 == 1 {
v.push("percent parent");
}
serializer.serialize_str(&v.join("+"))
}
}
pub enum Hoverinfo {
Flags(HoverinfoFlags),
All,
None,
Skip,
}
impl serde::Serialize for Hoverinfo {
fn serialize<S: serde::Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {
match self {
Self::All => serializer.serialize_str("all"),
Self::None => serializer.serialize_str("none"),
Self::Skip => serializer.serialize_str("skip"),
Self::Flags(v) => v.serialize(serializer),
}
}
}
impl Default for Hoverinfo {
fn default() -> Self {
Self::Flags(HoverinfoFlags::default())
}
}
impl Hoverinfo {
pub fn flags(&mut self) -> &mut HoverinfoFlags {
*self = Self::Flags(HoverinfoFlags::default());
match self {
Self::Flags(v) => v,
_ => unreachable!(),
}
}
pub fn set(&mut self, v: Hoverinfo) {
*self = v;
}
}
#[derive(Default, Serialize)]
pub struct Textfont<'a> {
#[serde(rename = "family")]
#[serde(skip_serializing_if = "Option::is_none")]
family: Option<&'a str>,
#[serde(rename = "size")]
#[serde(skip_serializing_if = "Option::is_none")]
size: Option<f64>,
#[serde(rename = "color")]
#[serde(skip_serializing_if = "Option::is_none")]
color: Option<&'a str>,
}
impl<'a> Textfont<'a> {
pub fn family(&mut self, family: &'a str) -> &mut Self {
self.family = Some(family);
self
}
pub fn size(&mut self, size: f64) -> &mut Self {
self.size = Some(size);
self
}
pub fn color(&mut self, color: &'a str) -> &mut Self {
self.color = Some(color);
self
}
}
#[derive(Default, Serialize)]
pub struct Insidetextfont<'a> {
#[serde(rename = "family")]
#[serde(skip_serializing_if = "Option::is_none")]
family: Option<&'a str>,
#[serde(rename = "size")]
#[serde(skip_serializing_if = "Option::is_none")]
size: Option<f64>,
#[serde(rename = "color")]
#[serde(skip_serializing_if = "Option::is_none")]
color: Option<&'a str>,
}
impl<'a> Insidetextfont<'a> {
pub fn family(&mut self, family: &'a str) -> &mut Self {
self.family = Some(family);
self
}
pub fn size(&mut self, size: f64) -> &mut Self {
self.size = Some(size);
self
}
pub fn color(&mut self, color: &'a str) -> &mut Self {
self.color = Some(color);
self
}
}
#[derive(Default, Serialize)]
pub struct Outsidetextfont<'a> {
#[serde(rename = "family")]
#[serde(skip_serializing_if = "Option::is_none")]
family: Option<&'a str>,
#[serde(rename = "size")]
#[serde(skip_serializing_if = "Option::is_none")]
size: Option<f64>,
#[serde(rename = "color")]
#[serde(skip_serializing_if = "Option::is_none")]
color: Option<&'a str>,
}
impl<'a> Outsidetextfont<'a> {
pub fn family(&mut self, family: &'a str) -> &mut Self {
self.family = Some(family);
self
}
pub fn size(&mut self, size: f64) -> &mut Self {
self.size = Some(size);
self
}
pub fn color(&mut self, color: &'a str) -> &mut Self {
self.color = Some(color);
self
}
}
pub enum Textposition {
TopLeft,
TopCenter,
TopRight,
MiddleLeft,
MiddleCenter,
MiddleRight,
BottomLeft,
BottomCenter,
BottomRight,
}
impl serde::Serialize for Textposition {
fn serialize<S: serde::Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {
match self {
Self::TopLeft => serializer.serialize_str("top left"),
Self::TopCenter => serializer.serialize_str("top center"),
Self::TopRight => serializer.serialize_str("top right"),
Self::MiddleLeft => serializer.serialize_str("middle left"),
Self::MiddleCenter => serializer.serialize_str("middle center"),
Self::MiddleRight => serializer.serialize_str("middle right"),
Self::BottomLeft => serializer.serialize_str("bottom left"),
Self::BottomCenter => serializer.serialize_str("bottom center"),
Self::BottomRight => serializer.serialize_str("bottom right"),
}
}
}
#[derive(Default, Serialize)]
pub struct Domain<'a> {
#[serde(rename = "x")]
#[serde(skip_serializing_if = "Option::is_none")]
x: Option<&'a crate::InfoArray>,
#[serde(rename = "y")]
#[serde(skip_serializing_if = "Option::is_none")]
y: Option<&'a crate::InfoArray>,
#[serde(rename = "row")]
#[serde(skip_serializing_if = "Option::is_none")]
row: Option<u64>,
#[serde(rename = "column")]
#[serde(skip_serializing_if = "Option::is_none")]
column: Option<u64>,
}
impl<'a> Domain<'a> {
pub fn x(&mut self, x: &'a crate::InfoArray) -> &mut Self {
self.x = Some(x);
self
}
pub fn y(&mut self, y: &'a crate::InfoArray) -> &mut Self {
self.y = Some(y);
self
}
pub fn row(&mut self, row: u64) -> &mut Self {
self.row = Some(row);
self
}
pub fn column(&mut self, column: u64) -> &mut Self {
self.column = Some(column);
self
}
}