Skip to content

Commit

Permalink
Add label to scatter.rs
Browse files Browse the repository at this point in the history
Add label to scatter.rs
  • Loading branch information
LukaOber authored Oct 11, 2024
2 parents 371ac0e + 77e1130 commit 196fb3f
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion charming/src/series/scatter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use serde::Serialize;
use crate::{
datatype::{DataFrame, DataPoint},
element::{
ColorBy, CoordinateSystem, DimensionEncode, Emphasis, ItemStyle, MarkArea, MarkLine,
ColorBy, CoordinateSystem, DimensionEncode, Emphasis, ItemStyle, Label, MarkArea, MarkLine,
Symbol, SymbolSize,
},
};
Expand All @@ -23,6 +23,9 @@ pub struct Scatter {
#[serde(skip_serializing_if = "Option::is_none")]
color_by: Option<ColorBy>,

#[serde(skip_serializing_if = "Option::is_none")]
label: Option<Label>,

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

Expand Down Expand Up @@ -73,6 +76,7 @@ impl Scatter {
id: None,
name: None,
color_by: None,
label: None,
dataset_index: None,
coordinate_system: None,
x_axis_index: None,
Expand Down Expand Up @@ -103,6 +107,11 @@ impl Scatter {
self
}

pub fn label<L: Into<Label>>(mut self, label: L) -> Self {
self.label = Some(label.into());
self
}

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

0 comments on commit 196fb3f

Please sign in to comment.