Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add some missing fields #102

Merged
merged 3 commits into from
Oct 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions charming/src/element/mark_line.rs
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,12 @@ pub struct MarkLine {
#[serde(skip_serializing_if = "Vec::is_empty")]
symbol: Vec<Symbol>,

#[serde(skip_serializing_if = "Option::is_none")]
precision: Option<f64>,

#[serde(skip_serializing_if = "Option::is_none")]
silent: Option<bool>,

#[serde(skip_serializing_if = "Vec::is_empty")]
data: Vec<MarkLineVariant>,
}
Expand All @@ -186,6 +192,8 @@ impl MarkLine {
zlevel: None,
z: None,
symbol: vec![],
precision: None,
silent: None,
data: vec![],
}
}
Expand Down Expand Up @@ -215,6 +223,16 @@ impl MarkLine {
self
}

pub fn precision<F: Into<f64>>(mut self, precision: F) -> Self {
self.precision = Some(precision.into());
self
}

pub fn silent(mut self, silent: bool) -> Self {
self.silent = Some(silent);
self
}

pub fn data<M: Into<MarkLineVariant>>(mut self, data: Vec<M>) -> Self {
self.data = data.into_iter().map(|m| m.into()).collect();
self
Expand Down
13 changes: 12 additions & 1 deletion charming/src/series/bar.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@ use serde::Serialize;

use crate::{
datatype::{DataFrame, DataPoint},
element::{BackgroundStyle, ColorBy, CoordinateSystem, Emphasis, ItemStyle, Label, MarkLine},
element::{
BackgroundStyle, ColorBy, CoordinateSystem, Emphasis, ItemStyle, Label, MarkLine, Tooltip,
},
};

#[derive(Serialize, Debug, PartialEq, PartialOrd, Clone)]
Expand Down Expand Up @@ -67,6 +69,9 @@ pub struct Bar {
#[serde(skip_serializing_if = "Option::is_none")]
bar_width: Option<f64>,

#[serde(skip_serializing_if = "Option::is_none")]
tooltip: Option<Tooltip>,

#[serde(skip_serializing_if = "Vec::is_empty")]
data: DataFrame,
}
Expand Down Expand Up @@ -99,6 +104,7 @@ impl Bar {
mark_line: None,
stack: None,
bar_width: None,
tooltip: None,
data: vec![],
}
}
Expand Down Expand Up @@ -193,6 +199,11 @@ impl Bar {
self
}

pub fn tooltip(mut self, tooltip: Tooltip) -> Self {
self.tooltip = Some(tooltip);
self
}

pub fn data<D: Into<DataPoint>>(mut self, data: Vec<D>) -> Self {
self.data = data.into_iter().map(|d| d.into()).collect();
self
Expand Down
11 changes: 10 additions & 1 deletion charming/src/series/boxplot.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use serde::Serialize;

use crate::element::{ColorBy, CoordinateSystem};
use crate::element::{ColorBy, CoordinateSystem, Tooltip};

#[derive(Serialize, Debug, PartialEq, PartialOrd, Clone)]
#[serde(rename_all = "camelCase")]
Expand Down Expand Up @@ -28,6 +28,9 @@ pub struct Boxplot {

#[serde(skip_serializing_if = "Option::is_none")]
dataset_index: Option<u64>,

#[serde(skip_serializing_if = "Option::is_none")]
tooltip: Option<Tooltip>,
}

impl Default for Boxplot {
Expand All @@ -47,6 +50,7 @@ impl Boxplot {
legend_hover_link: None,
hover_animation: None,
dataset_index: None,
tooltip: None,
}
}

Expand Down Expand Up @@ -84,4 +88,9 @@ impl Boxplot {
self.dataset_index = Some(dataset_index);
self
}

pub fn tooltip(mut self, tooltip: Tooltip) -> Self {
self.tooltip = Some(tooltip);
self
}
}
11 changes: 10 additions & 1 deletion charming/src/series/candlestick.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use serde::Serialize;

use crate::{
datatype::{DataFrame, DataPoint},
element::{ColorBy, CoordinateSystem},
element::{ColorBy, CoordinateSystem, Tooltip},
};

#[derive(Serialize, Debug, PartialEq, PartialOrd, Clone)]
Expand All @@ -26,6 +26,9 @@ pub struct Candlestick {
#[serde(skip_serializing_if = "Option::is_none")]
legend_hover_link: Option<bool>,

#[serde(skip_serializing_if = "Option::is_none")]
tooltip: Option<Tooltip>,

#[serde(skip_serializing_if = "Vec::is_empty")]
data: DataFrame,
}
Expand All @@ -46,6 +49,7 @@ impl Candlestick {
color_by: None,
legend_hover_link: None,
data: vec![],
tooltip: None,
}
}

Expand Down Expand Up @@ -74,6 +78,11 @@ impl Candlestick {
self
}

pub fn tooltip(mut self, tooltip: Tooltip) -> Self {
self.tooltip = Some(tooltip);
self
}

pub fn data<D: Into<DataPoint>>(mut self, data: Vec<D>) -> Self {
self.data = data.into_iter().map(|d| d.into()).collect();
self
Expand Down
10 changes: 10 additions & 0 deletions charming/src/series/custom.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ use crate::{
datatype::{CompositeValue, DataFrame, DataPoint, Dimension},
element::{
ColorBy, CoordinateSystem, DimensionEncode, ItemStyle, LabelLayout, LabelLine, RawString,
Tooltip,
},
};

Expand Down Expand Up @@ -63,6 +64,9 @@ pub struct Custom {
#[serde(skip_serializing_if = "Option::is_none")]
encode: Option<DimensionEncode>,

#[serde(skip_serializing_if = "Option::is_none")]
tooltip: Option<Tooltip>,

#[serde(skip_serializing_if = "Vec::is_empty")]
data: DataFrame,
}
Expand Down Expand Up @@ -94,6 +98,7 @@ impl Custom {
selected_mode: None,
dimensions: vec![],
encode: None,
tooltip: None,
data: vec![],
}
}
Expand Down Expand Up @@ -183,6 +188,11 @@ impl Custom {
self
}

pub fn tooltip(mut self, tooltip: Tooltip) -> Self {
self.tooltip = Some(tooltip);
self
}

pub fn data<D: Into<DataPoint>>(mut self, data: Vec<D>) -> Self {
self.data = data.into_iter().map(|d| d.into()).collect();
self
Expand Down
11 changes: 10 additions & 1 deletion charming/src/series/effect_scatter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use crate::{
datatype::{DataFrame, DataPoint},
element::{
Color, ColorBy, CoordinateSystem, Emphasis, ItemStyle, Label, LabelLayout, LabelLine,
Symbol,
Symbol, Tooltip,
},
};

Expand Down Expand Up @@ -162,6 +162,9 @@ pub struct EffectScatter {
#[serde(skip_serializing_if = "Option::is_none")]
emphasis: Option<Emphasis>,

#[serde(skip_serializing_if = "Option::is_none")]
tooltip: Option<Tooltip>,

#[serde(skip_serializing_if = "Vec::is_empty")]
data: DataFrame,
}
Expand Down Expand Up @@ -198,6 +201,7 @@ impl EffectScatter {
label_layout: None,
item_style: None,
emphasis: None,
tooltip: None,
data: vec![],
}
}
Expand Down Expand Up @@ -312,6 +316,11 @@ impl EffectScatter {
self
}

pub fn tooltip(mut self, tooltip: Tooltip) -> Self {
self.tooltip = Some(tooltip);
self
}

pub fn data<D: Into<DataPoint>>(mut self, data: Vec<D>) -> Self {
self.data = data.into_iter().map(|d| d.into()).collect();
self
Expand Down
11 changes: 10 additions & 1 deletion charming/src/series/funnel.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use serde::Serialize;

use crate::{
datatype::{CompositeValue, DataFrame, DataPoint},
element::{ColorBy, Emphasis, ItemStyle, Label, LabelLine, Orient, Sort},
element::{ColorBy, Emphasis, ItemStyle, Label, LabelLine, Orient, Sort, Tooltip},
};

#[derive(Serialize, Debug, PartialEq, PartialOrd, Clone)]
Expand Down Expand Up @@ -85,6 +85,9 @@ pub struct Funnel {
#[serde(skip_serializing_if = "Option::is_none")]
emphasis: Option<Emphasis>,

#[serde(skip_serializing_if = "Option::is_none")]
tooltip: Option<Tooltip>,

#[serde(skip_serializing_if = "Vec::is_empty")]
data: DataFrame,
}
Expand Down Expand Up @@ -121,6 +124,7 @@ impl Funnel {
label_line: None,
item_style: None,
emphasis: None,
tooltip: None,
data: vec![],
}
}
Expand Down Expand Up @@ -235,6 +239,11 @@ impl Funnel {
self
}

pub fn tooltip(mut self, tooltip: Tooltip) -> Self {
self.tooltip = Some(tooltip);
self
}

pub fn data<D: Into<DataPoint>>(mut self, data: Vec<D>) -> Self {
self.data = data.into_iter().map(|d| d.into()).collect();
self
Expand Down
11 changes: 10 additions & 1 deletion charming/src/series/gauge.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use crate::{
datatype::{DataFrame, DataPoint},
element::{
Anchor, AxisLabel, AxisLine, AxisTick, Color, ColorBy, Formatter, ItemStyle, Pointer,
SplitLine,
SplitLine, Tooltip,
},
};

Expand Down Expand Up @@ -287,6 +287,9 @@ pub struct Gauge {
#[serde(skip_serializing_if = "Option::is_none")]
title: Option<GaugeTitle>,

#[serde(skip_serializing_if = "Option::is_none")]
tooltip: Option<Tooltip>,

#[serde(skip_serializing_if = "Vec::is_empty")]
data: DataFrame,
}
Expand Down Expand Up @@ -324,6 +327,7 @@ impl Gauge {
anchor: None,
detail: None,
title: None,
tooltip: None,
data: vec![],
}
}
Expand Down Expand Up @@ -443,6 +447,11 @@ impl Gauge {
self
}

pub fn tooltip(mut self, tooltip: Tooltip) -> Self {
self.tooltip = Some(tooltip);
self
}

pub fn data<D: Into<DataPoint>>(mut self, data: Vec<D>) -> Self {
self.data = data.into_iter().map(|d| d.into()).collect();
self
Expand Down
11 changes: 10 additions & 1 deletion charming/src/series/graph.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use serde::{Deserialize, Serialize};

use crate::element::{CoordinateSystem, Label, LabelLayout, LineStyle, ScaleLimit};
use crate::element::{CoordinateSystem, Label, LabelLayout, LineStyle, ScaleLimit, Tooltip};

#[derive(Serialize, Debug, PartialEq, PartialOrd, Clone)]
#[serde(rename_all = "camelCase")]
Expand Down Expand Up @@ -275,6 +275,9 @@ pub struct Graph {

#[serde(skip_serializing_if = "Option::is_none")]
edge_symbol: Option<(String, String)>,

#[serde(skip_serializing_if = "Option::is_none")]
tooltip: Option<Tooltip>,
}

impl Default for Graph {
Expand Down Expand Up @@ -308,6 +311,7 @@ impl Graph {
links: vec![],
data: vec![],
edge_symbol: None,
tooltip: None,
}
}

Expand Down Expand Up @@ -407,4 +411,9 @@ impl Graph {
self.edge_symbol = edge_symbol;
self
}

pub fn tooltip(mut self, tooltip: Tooltip) -> Self {
self.tooltip = Some(tooltip);
self
}
}
11 changes: 10 additions & 1 deletion charming/src/series/heatmap.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use serde::Serialize;

use crate::{
datatype::DataFrame,
element::{CoordinateSystem, Emphasis, ItemStyle, Label},
element::{CoordinateSystem, Emphasis, ItemStyle, Label, Tooltip},
};

#[derive(Serialize, Debug, PartialEq, PartialOrd, Clone)]
Expand Down Expand Up @@ -59,6 +59,9 @@ pub struct Heatmap {
#[serde(skip_serializing_if = "Option::is_none")]
emphasis: Option<Emphasis>,

#[serde(skip_serializing_if = "Option::is_none")]
tooltip: Option<Tooltip>,

#[serde(skip_serializing_if = "Vec::is_empty")]
data: Vec<DataFrame>,
}
Expand Down Expand Up @@ -89,6 +92,7 @@ impl Heatmap {
label: None,
item_style: None,
emphasis: None,
tooltip: None,
data: vec![],
}
}
Expand Down Expand Up @@ -173,6 +177,11 @@ impl Heatmap {
self
}

pub fn tooltip(mut self, tooltip: Tooltip) -> Self {
self.tooltip = Some(tooltip);
self
}

pub fn data<S: Into<DataFrame>>(mut self, data: Vec<S>) -> Self {
self.data = data.into_iter().map(|d| d.into()).collect();
self
Expand Down
Loading
Loading