Skip to main content

LabelOption

Struct LabelOption 

Source
pub struct LabelOption {
Show 24 fields pub show: bool, pub text: Option<String>, pub position: Option<Position>, pub offset: Option<LabelOffset>, pub distance: Option<f64>, pub rotate: Option<f64>, pub align: Option<TextAlign>, pub vertical_align: Option<TextVerticalAlign>, pub color: Option<String>, pub font_family: Option<String>, pub font_size: Option<f64>, pub font_weight: Option<String>, pub font_style: Option<String>, pub line_height: Option<f64>, pub background_color: Option<String>, pub padding: Option<(f64, f64, f64, f64)>, pub border_color: Option<String>, pub border_width: Option<f64>, pub border_radius: Option<f64>, pub stroke: Option<bool>, pub stroke_width: Option<f64>, pub stroke_color: Option<String>, pub hide_overlap: Option<bool>, pub formatter: Option<String>,
}
Expand description

The text drawn next to a data point, an axis, or a legend entry.

Fields§

§show: bool

Whether the label is drawn.

§text: Option<String>

The text of the label.

None means “derive it from the data”; a template uses the ECharts syntax, for example "{b}: {c}".

§position: Option<Position>

The position of the label relative to its anchor.

§offset: Option<LabelOffset>

The offset of the label from its anchor.

§distance: Option<f64>

The distance between the label and the anchor, in pixels.

§rotate: Option<f64>

The rotation of the label, in degrees.

§align: Option<TextAlign>

The alignment of the label.

§vertical_align: Option<TextVerticalAlign>

The vertical alignment of the label.

§color: Option<String>

The colour of the label.

§font_family: Option<String>

The font family of the label.

§font_size: Option<f64>

The font size of the label, in pixels.

§font_weight: Option<String>

The font weight of the label.

§font_style: Option<String>

The font style of the label.

§line_height: Option<f64>

The line height of the label, as a multiple of the font size.

§background_color: Option<String>

The background colour of the label.

§padding: Option<(f64, f64, f64, f64)>

The padding inside the label’s background.

§border_color: Option<String>

The border colour of the label’s background.

§border_width: Option<f64>

The border width of the label’s background.

§border_radius: Option<f64>

The radius of the label’s background corners.

§stroke: Option<bool>

Whether the label is stroked with an outline.

§stroke_width: Option<f64>

The width of the label’s outline.

§stroke_color: Option<String>

The colour of the label’s outline.

§hide_overlap: Option<bool>

Whether the label is hidden when it would overlap another one.

§formatter: Option<String>

The formatter used when the text is not a template.

Implementations§

Source§

impl LabelOption

Inherent implementation of LabelOption.

Source

pub fn new() -> Self

Returns a visible label.

Source

pub fn color(self, color: &str) -> Self

Sets the colour of the label.

§Arguments
  • &str - Shared reference to a str.
Source

pub fn font_size(self, size: f64) -> Self

Sets the font size of the label.

§Arguments
  • f64 - A 64-bit float (f64).
Source

pub fn font_family(self, family: &str) -> Self

Sets the font family of the label.

§Arguments
  • &str - Shared reference to a str.
Source§

impl LabelOption

Source

pub fn get_show(&self) -> bool

Source

pub fn get_mut_show(&mut self) -> &mut bool

Source

pub fn set_show(&mut self, val: bool) -> &mut Self

Source

pub fn get_text(&self) -> Option<String>

Source

pub fn try_get_text(&self) -> Option<String>

Source

pub fn get_mut_text(&mut self) -> &mut Option<String>

Source

pub fn set_text(&mut self, val: Option<String>) -> &mut Self

Source

pub fn get_position(&self) -> Option<Position>

Source

pub fn try_get_position(&self) -> Option<Position>

Source

pub fn get_mut_position(&mut self) -> &mut Option<Position>

Source

pub fn set_position(&mut self, val: Option<Position>) -> &mut Self

Source

pub fn get_offset(&self) -> Option<LabelOffset>

Source

pub fn try_get_offset(&self) -> Option<LabelOffset>

Source

pub fn get_mut_offset(&mut self) -> &mut Option<LabelOffset>

Source

pub fn set_offset(&mut self, val: Option<LabelOffset>) -> &mut Self

Source

pub fn get_distance(&self) -> Option<f64>

Source

pub fn try_get_distance(&self) -> Option<f64>

Source

pub fn get_mut_distance(&mut self) -> &mut Option<f64>

Source

pub fn set_distance(&mut self, val: Option<f64>) -> &mut Self

Source

pub fn get_rotate(&self) -> Option<f64>

Source

pub fn try_get_rotate(&self) -> Option<f64>

Source

pub fn get_mut_rotate(&mut self) -> &mut Option<f64>

Source

pub fn set_rotate(&mut self, val: Option<f64>) -> &mut Self

Source

pub fn get_align(&self) -> Option<TextAlign>

Source

pub fn try_get_align(&self) -> Option<TextAlign>

Source

pub fn get_mut_align(&mut self) -> &mut Option<TextAlign>

Source

pub fn set_align(&mut self, val: Option<TextAlign>) -> &mut Self

Source

pub fn get_vertical_align(&self) -> Option<TextVerticalAlign>

Source

pub fn try_get_vertical_align(&self) -> Option<TextVerticalAlign>

Source

pub fn get_mut_vertical_align(&mut self) -> &mut Option<TextVerticalAlign>

Source

pub fn set_vertical_align( &mut self, val: Option<TextVerticalAlign>, ) -> &mut Self

Source

pub fn get_color(&self) -> Option<String>

Source

pub fn try_get_color(&self) -> Option<String>

Source

pub fn get_mut_color(&mut self) -> &mut Option<String>

Source

pub fn set_color(&mut self, val: Option<String>) -> &mut Self

Source

pub fn get_font_family(&self) -> Option<String>

Source

pub fn try_get_font_family(&self) -> Option<String>

Source

pub fn get_mut_font_family(&mut self) -> &mut Option<String>

Source

pub fn set_font_family(&mut self, val: Option<String>) -> &mut Self

Source

pub fn get_font_size(&self) -> Option<f64>

Source

pub fn try_get_font_size(&self) -> Option<f64>

Source

pub fn get_mut_font_size(&mut self) -> &mut Option<f64>

Source

pub fn set_font_size(&mut self, val: Option<f64>) -> &mut Self

Source

pub fn get_font_weight(&self) -> Option<String>

Source

pub fn try_get_font_weight(&self) -> Option<String>

Source

pub fn get_mut_font_weight(&mut self) -> &mut Option<String>

Source

pub fn set_font_weight(&mut self, val: Option<String>) -> &mut Self

Source

pub fn get_font_style(&self) -> Option<String>

Source

pub fn try_get_font_style(&self) -> Option<String>

Source

pub fn get_mut_font_style(&mut self) -> &mut Option<String>

Source

pub fn set_font_style(&mut self, val: Option<String>) -> &mut Self

Source

pub fn get_line_height(&self) -> Option<f64>

Source

pub fn try_get_line_height(&self) -> Option<f64>

Source

pub fn get_mut_line_height(&mut self) -> &mut Option<f64>

Source

pub fn set_line_height(&mut self, val: Option<f64>) -> &mut Self

Source

pub fn get_background_color(&self) -> Option<String>

Source

pub fn try_get_background_color(&self) -> Option<String>

Source

pub fn get_mut_background_color(&mut self) -> &mut Option<String>

Source

pub fn set_background_color(&mut self, val: Option<String>) -> &mut Self

Source

pub fn get_padding(&self) -> Option<(f64, f64, f64, f64)>

Source

pub fn try_get_padding(&self) -> Option<(f64, f64, f64, f64)>

Source

pub fn get_mut_padding(&mut self) -> &mut Option<(f64, f64, f64, f64)>

Source

pub fn set_padding(&mut self, val: Option<(f64, f64, f64, f64)>) -> &mut Self

Source

pub fn get_border_color(&self) -> Option<String>

Source

pub fn try_get_border_color(&self) -> Option<String>

Source

pub fn get_mut_border_color(&mut self) -> &mut Option<String>

Source

pub fn set_border_color(&mut self, val: Option<String>) -> &mut Self

Source

pub fn get_border_width(&self) -> Option<f64>

Source

pub fn try_get_border_width(&self) -> Option<f64>

Source

pub fn get_mut_border_width(&mut self) -> &mut Option<f64>

Source

pub fn set_border_width(&mut self, val: Option<f64>) -> &mut Self

Source

pub fn get_border_radius(&self) -> Option<f64>

Source

pub fn try_get_border_radius(&self) -> Option<f64>

Source

pub fn get_mut_border_radius(&mut self) -> &mut Option<f64>

Source

pub fn set_border_radius(&mut self, val: Option<f64>) -> &mut Self

Source

pub fn get_stroke(&self) -> Option<bool>

Source

pub fn try_get_stroke(&self) -> Option<bool>

Source

pub fn get_mut_stroke(&mut self) -> &mut Option<bool>

Source

pub fn set_stroke(&mut self, val: Option<bool>) -> &mut Self

Source

pub fn get_stroke_width(&self) -> Option<f64>

Source

pub fn try_get_stroke_width(&self) -> Option<f64>

Source

pub fn get_mut_stroke_width(&mut self) -> &mut Option<f64>

Source

pub fn set_stroke_width(&mut self, val: Option<f64>) -> &mut Self

Source

pub fn get_stroke_color(&self) -> Option<String>

Source

pub fn try_get_stroke_color(&self) -> Option<String>

Source

pub fn get_mut_stroke_color(&mut self) -> &mut Option<String>

Source

pub fn set_stroke_color(&mut self, val: Option<String>) -> &mut Self

Source

pub fn get_hide_overlap(&self) -> Option<bool>

Source

pub fn try_get_hide_overlap(&self) -> Option<bool>

Source

pub fn get_mut_hide_overlap(&mut self) -> &mut Option<bool>

Source

pub fn set_hide_overlap(&mut self, val: Option<bool>) -> &mut Self

Source

pub fn get_formatter(&self) -> Option<String>

Source

pub fn try_get_formatter(&self) -> Option<String>

Source

pub fn get_mut_formatter(&mut self) -> &mut Option<String>

Source

pub fn set_formatter(&mut self, val: Option<String>) -> &mut Self

Trait Implementations§

Source§

impl Clone for LabelOption

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for LabelOption

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for LabelOption

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl PartialEq for LabelOption

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for LabelOption

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<S, T> Upcast<T> for S
where T: UpcastFrom<S> + ?Sized, S: ?Sized,

Source§

fn upcast(&self) -> &T
where Self: ErasableGeneric, T: Sized + ErasableGeneric<Repr = Self::Repr>,

Perform a zero-cost type-safe upcast to a wider ref type within the Wasm bindgen generics type system. Read more
Source§

fn upcast_into(self) -> T
where Self: Sized + ErasableGeneric, T: Sized + ErasableGeneric<Repr = Self::Repr>,

Perform a zero-cost type-safe upcast to a wider type within the Wasm bindgen generics type system. Read more