pub struct HeaderBuilder { /* private fields */ }
Expand description

Builder for Header.

Implementations§

source§

impl HeaderBuilder

source

pub fn format<VALUE: Into<Format>>(&mut self, value: VALUE) -> &mut Self

When used with the default "number" and "time" format type, the text formatting pattern for labels of guides (axes, legends, headers) and text marks.

See the format documentation for more examples.

When used with a custom formatType, this value will be passed as format alongside datum.value to the registered function.

Default value: Derived from numberFormat config for number format and from timeFormat config for time format.

source

pub fn format_type<VALUE: Into<String>>(&mut self, value: VALUE) -> &mut Self

The format type for labels. One of "number", "time", or a registered custom format type.

Default value: - "time" for temporal fields and ordinal and nominal fields with timeUnit. - "number" for quantitative fields as well as ordinal and nominal fields without timeUnit.

source

pub fn label_align<VALUE: Into<TitleAlignUnion>>( &mut self, value: VALUE ) -> &mut Self

Horizontal text alignment of header labels. One of "left", "center", or "right".

source

pub fn label_anchor<VALUE: Into<TitleAnchorEnum>>( &mut self, value: VALUE ) -> &mut Self

The anchor position for placing the labels. One of "start", "middle", or "end". For example, with a label orientation of top these anchor positions map to a left-, center-, or right-aligned label.

source

pub fn label_angle<VALUE: Into<f64>>(&mut self, value: VALUE) -> &mut Self

The rotation angle of the header labels.

Default value: 0 for column header, -90 for row header.

source

pub fn label_baseline<VALUE: Into<TextBaseline>>( &mut self, value: VALUE ) -> &mut Self

The vertical text baseline for the header labels. One of "alphabetic" (default), "top", "middle", "bottom", "line-top", or "line-bottom". The "line-top" and "line-bottom" values operate similarly to "top" and "bottom", but are calculated relative to the titleLineHeight rather than titleFontSize alone.

source

pub fn label_color<VALUE: Into<Box<Color>>>( &mut self, value: VALUE ) -> &mut Self

The color of the header label, can be in hex color code or regular color name.

source

pub fn label_expr<VALUE: Into<String>>(&mut self, value: VALUE) -> &mut Self

Vega expression for customizing labels.

Note: The label text and value can be assessed via the label and value properties of the header’s backing datum object.

source

pub fn label_font<VALUE: Into<Box<Color>>>(&mut self, value: VALUE) -> &mut Self

The font of the header label.

source

pub fn label_font_size<VALUE: Into<CornerRadiusUnion>>( &mut self, value: VALUE ) -> &mut Self

The font size of the header label, in pixels.

source

pub fn label_font_style<VALUE: Into<Box<Color>>>( &mut self, value: VALUE ) -> &mut Self

The font style of the header label.

source

pub fn label_font_weight<VALUE: Into<FontWeightUnion>>( &mut self, value: VALUE ) -> &mut Self

The font weight of the header label.

source

pub fn label_limit<VALUE: Into<CornerRadiusUnion>>( &mut self, value: VALUE ) -> &mut Self

The maximum length of the header label in pixels. The text value will be automatically truncated if the rendered size exceeds the limit.

Default value: 0, indicating no limit

source

pub fn label_line_height<VALUE: Into<CornerRadiusUnion>>( &mut self, value: VALUE ) -> &mut Self

Line height in pixels for multi-line header labels or title text with "line-top" or "line-bottom" baseline.

source

pub fn label_orient<VALUE: Into<Orient>>(&mut self, value: VALUE) -> &mut Self

The orientation of the header label. One of "top", "bottom", "left" or "right".

source

pub fn label_padding<VALUE: Into<CornerRadiusUnion>>( &mut self, value: VALUE ) -> &mut Self

The padding, in pixel, between facet header’s label and the plot.

Default value: 10

source

pub fn labels<VALUE: Into<bool>>(&mut self, value: VALUE) -> &mut Self

A boolean flag indicating if labels should be included as part of the header.

Default value: true.

source

pub fn orient<VALUE: Into<Orient>>(&mut self, value: VALUE) -> &mut Self

Shortcut for setting both labelOrient and titleOrient.

source

pub fn title<VALUE: Into<RemovableValue<LegendText>>>( &mut self, value: VALUE ) -> &mut Self

A title for the field. If null, the title will be removed.

Default value: derived from the field’s name and transformation function (aggregate, bin and timeUnit). If the field has an aggregate function, the function is displayed as part of the title (e.g., "Sum of Profit"). If the field is binned or has a time unit applied, the applied function is shown in parentheses (e.g., "Profit (binned)", "Transaction Date (year-month)"). Otherwise, the title is simply the field name.

Notes:

  1. You can customize the default field title format by providing the fieldTitle property in the config or fieldTitle function via the compile function’s options.

  2. If both field definition’s title and axis, header, or legend title are defined, axis/header/legend title will be used.

source

pub fn title_align<VALUE: Into<TitleAlignUnion>>( &mut self, value: VALUE ) -> &mut Self

Horizontal text alignment (to the anchor) of header titles.

source

pub fn title_anchor<VALUE: Into<TitleAnchorEnum>>( &mut self, value: VALUE ) -> &mut Self

The anchor position for placing the title. One of "start", "middle", or "end". For example, with an orientation of top these anchor positions map to a left-, center-, or right-aligned title.

source

pub fn title_angle<VALUE: Into<f64>>(&mut self, value: VALUE) -> &mut Self

The rotation angle of the header title.

Default value: 0.

source

pub fn title_baseline<VALUE: Into<TextBaseline>>( &mut self, value: VALUE ) -> &mut Self

The vertical text baseline for the header title. One of "alphabetic" (default), "top", "middle", "bottom", "line-top", or "line-bottom". The "line-top" and "line-bottom" values operate similarly to "top" and "bottom", but are calculated relative to the titleLineHeight rather than titleFontSize alone.

Default value: "middle"

source

pub fn title_color<VALUE: Into<Box<Color>>>( &mut self, value: VALUE ) -> &mut Self

Color of the header title, can be in hex color code or regular color name.

source

pub fn title_font<VALUE: Into<Box<Color>>>(&mut self, value: VALUE) -> &mut Self

Font of the header title. (e.g., "Helvetica Neue").

source

pub fn title_font_size<VALUE: Into<CornerRadiusUnion>>( &mut self, value: VALUE ) -> &mut Self

Font size of the header title.

source

pub fn title_font_style<VALUE: Into<Box<Color>>>( &mut self, value: VALUE ) -> &mut Self

The font style of the header title.

source

pub fn title_font_weight<VALUE: Into<FontWeightUnion>>( &mut self, value: VALUE ) -> &mut Self

Font weight of the header title. This can be either a string (e.g "bold", "normal") or a number (100, 200, 300, …, 900 where "normal" = 400 and "bold" = 700).

source

pub fn title_limit<VALUE: Into<CornerRadiusUnion>>( &mut self, value: VALUE ) -> &mut Self

The maximum length of the header title in pixels. The text value will be automatically truncated if the rendered size exceeds the limit.

Default value: 0, indicating no limit

source

pub fn title_line_height<VALUE: Into<CornerRadiusUnion>>( &mut self, value: VALUE ) -> &mut Self

Line height in pixels for multi-line header title text or title text with "line-top" or "line-bottom" baseline.

source

pub fn title_orient<VALUE: Into<Orient>>(&mut self, value: VALUE) -> &mut Self

The orientation of the header title. One of "top", "bottom", "left" or "right".

source

pub fn title_padding<VALUE: Into<CornerRadiusUnion>>( &mut self, value: VALUE ) -> &mut Self

The padding, in pixel, between facet header’s title and the label.

Default value: 10

source

pub fn build(&self) -> Result<Header, HeaderBuilderError>

Builds a new Header.

Errors

If a required field has not been initialized.

Trait Implementations§

source§

impl Clone for HeaderBuilder

source§

fn clone(&self) -> HeaderBuilder

Returns a copy of the value. Read more
1.0.0 · source§

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

Performs copy-assignment from source. Read more
source§

impl Default for HeaderBuilder

source§

fn default() -> Self

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

Auto Trait Implementations§

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

source§

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

Mutably borrows from an owned value. 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 Twhere 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 Twhere T: Clone,

§

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 Twhere U: Into<T>,

§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

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

§

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.