Skip to content

Commit

Permalink
Merge pull request #25 from yuankunzhang/label-in-line-series
Browse files Browse the repository at this point in the history
Support label in line series
  • Loading branch information
yuankunzhang authored Sep 19, 2023
2 parents 68e19e1 + 128ef83 commit 2017c15
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions charming/src/series/line.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ use serde::Serialize;
use crate::{
datatype::{DataFrame, DataPoint},
element::{
AreaStyle, CoordinateSystem, DimensionEncode, Emphasis, ItemStyle, LineStyle, MarkArea,
MarkLine, MarkPoint, Symbol,
AreaStyle, CoordinateSystem, DimensionEncode, Emphasis, ItemStyle, Label, LineStyle,
MarkArea, MarkLine, MarkPoint, Symbol,
},
};

Expand Down Expand Up @@ -35,6 +35,9 @@ pub struct Line {
#[serde(skip_serializing_if = "Option::is_none")]
stack: Option<String>,

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

#[serde(skip_serializing_if = "Option::is_none")]
line_style: Option<LineStyle>,

Expand Down Expand Up @@ -86,6 +89,7 @@ impl Line {
symbol_size: None,
show_symbol: None,
stack: None,
label: None,
line_style: None,
area_style: None,
item_style: None,
Expand Down Expand Up @@ -138,6 +142,11 @@ impl Line {
self
}

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

pub fn line_style<L: Into<LineStyle>>(mut self, line_style: L) -> Self {
self.line_style = Some(line_style.into());
self
Expand Down

0 comments on commit 2017c15

Please sign in to comment.