Skip to content

Commit

Permalink
Added label to scatter.rs
Browse files Browse the repository at this point in the history
Duplicated from '128ef83' commit, which added label in line series.
  • Loading branch information
humphreylee authored Oct 11, 2024
1 parent 371ac0e commit 850ea28
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions 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 @@ -22,7 +22,10 @@ pub struct Scatter {

Check warning on line 22 in charming/src/series/scatter.rs

View workflow job for this annotation

GitHub Actions / Linting and formatting

Diff in /home/runner/work/charming/charming/charming/src/series/scatter.rs
#[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());

Check warning on line 111 in charming/src/series/scatter.rs

View workflow job for this annotation

GitHub Actions / Linting and formatting

Diff in /home/runner/work/charming/charming/charming/src/series/scatter.rs
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 850ea28

Please sign in to comment.