[][src]Struct vega_lite_3::LegendBuilder

pub struct LegendBuilder { /* fields omitted */ }

Builder for Legend.

Methods

impl LegendBuilder[src]

pub fn clip_height<VALUE: Into<f64>>(&mut self, value: VALUE) -> &mut Self[src]

The height in pixels to clip symbol legend entries and limit their size.

pub fn column_padding<VALUE: Into<f64>>(&mut self, value: VALUE) -> &mut Self[src]

The horizontal padding in pixels between symbol legend entries.

Default value: 10.

pub fn columns<VALUE: Into<f64>>(&mut self, value: VALUE) -> &mut Self[src]

The number of columns in which to arrange symbol legend entries. A value of 0 or lower indicates a single row with one column per entry.

pub fn corner_radius<VALUE: Into<f64>>(&mut self, value: VALUE) -> &mut Self[src]

Corner radius for the full legend.

pub fn direction<VALUE: Into<Orientation>>(&mut self, value: VALUE) -> &mut Self[src]

The direction of the legend, one of "vertical" or "horizontal".

Default value:

  • For top-/bottom-oriented legends, "horizontal"
  • For left-/right-oriented legends, "vertical"
  • For top/bottom-left/right-oriented legends, "horizontal" for gradient legends and "vertical" for symbol legends.

pub fn fill_color<VALUE: Into<String>>(&mut self, value: VALUE) -> &mut Self[src]

Background fill color for the full legend.

pub fn format<VALUE: Into<String>>(&mut self, value: VALUE) -> &mut Self[src]

The text formatting pattern for labels of guides (axes, legends, headers) and text marks.

See the format documentation for more examples.

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

pub fn format_type<VALUE: Into<FormatType>>(
    &mut self,
    value: VALUE
) -> &mut Self
[src]

The format type for labels ("number" or "time").

Default value:

  • "time" for temporal fields and ordinal and nomimal fields with timeUnit.
  • "number" for quantitative fields as well as ordinal and nomimal fields without timeUnit.

pub fn gradient_length<VALUE: Into<f64>>(&mut self, value: VALUE) -> &mut Self[src]

The length in pixels of the primary axis of a color gradient. This value corresponds to the height of a vertical gradient or the width of a horizontal gradient.

Default value: 200.

pub fn gradient_opacity<VALUE: Into<f64>>(&mut self, value: VALUE) -> &mut Self[src]

Opacity of the color gradient.

pub fn gradient_stroke_color<VALUE: Into<String>>(
    &mut self,
    value: VALUE
) -> &mut Self
[src]

The color of the gradient stroke, can be in hex color code or regular color name.

Default value: "lightGray".

pub fn gradient_stroke_width<VALUE: Into<f64>>(
    &mut self,
    value: VALUE
) -> &mut Self
[src]

The width of the gradient stroke, in pixels.

Default value: 0.

pub fn gradient_thickness<VALUE: Into<f64>>(
    &mut self,
    value: VALUE
) -> &mut Self
[src]

The thickness in pixels of the color gradient. This value corresponds to the width of a vertical gradient or the height of a horizontal gradient.

Default value: 16.

pub fn grid_align<VALUE: Into<LayoutAlign>>(
    &mut self,
    value: VALUE
) -> &mut Self
[src]

The alignment to apply to symbol legends rows and columns. The supported string values are "all", "each" (the default), and none. For more information, see the grid layout documentation.

Default value: "each".

pub fn label_align<VALUE: Into<Align>>(&mut self, value: VALUE) -> &mut Self[src]

The alignment of the legend label, can be left, center, or right.

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

The position of the baseline of legend label, can be "top", "middle", "bottom", or "alphabetic".

Default value: "middle".

pub fn label_color<VALUE: Into<String>>(&mut self, value: VALUE) -> &mut Self[src]

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

pub fn label_font<VALUE: Into<String>>(&mut self, value: VALUE) -> &mut Self[src]

The font of the legend label.

pub fn label_font_size<VALUE: Into<f64>>(&mut self, value: VALUE) -> &mut Self[src]

The font size of legend label.

Default value: 10.

pub fn label_font_style<VALUE: Into<String>>(
    &mut self,
    value: VALUE
) -> &mut Self
[src]

The font style of legend label.

pub fn label_font_weight<VALUE: Into<FontWeight>>(
    &mut self,
    value: VALUE
) -> &mut Self
[src]

The font weight of legend label.

pub fn label_limit<VALUE: Into<f64>>(&mut self, value: VALUE) -> &mut Self[src]

Maximum allowed pixel width of legend tick labels.

Default value: 160.

pub fn label_offset<VALUE: Into<f64>>(&mut self, value: VALUE) -> &mut Self[src]

The offset of the legend label.

pub fn label_opacity<VALUE: Into<f64>>(&mut self, value: VALUE) -> &mut Self[src]

Opacity of labels.

pub fn label_overlap<VALUE: Into<LabelOverlap>>(
    &mut self,
    value: VALUE
) -> &mut Self
[src]

The strategy to use for resolving overlap of labels in gradient legends. If false, no overlap reduction is attempted. If set to true (default) or "parity", a strategy of removing every other label is used. If set to "greedy", a linear scan of the labels is performed, removing any label that overlaps with the last visible label (this often works better for log-scaled axes).

Default value: true.

pub fn label_padding<VALUE: Into<f64>>(&mut self, value: VALUE) -> &mut Self[src]

Padding in pixels between the legend and legend labels.

pub fn label_separation<VALUE: Into<f64>>(&mut self, value: VALUE) -> &mut Self[src]

The minimum separation that must be between label bounding boxes for them to be considered non-overlapping (default 0). This property is ignored if labelOverlap resolution is not enabled.

pub fn legend_x<VALUE: Into<f64>>(&mut self, value: VALUE) -> &mut Self[src]

Custom x-position for legend with orient "none".

pub fn legend_y<VALUE: Into<f64>>(&mut self, value: VALUE) -> &mut Self[src]

Custom y-position for legend with orient "none".

pub fn offset<VALUE: Into<f64>>(&mut self, value: VALUE) -> &mut Self[src]

The offset in pixels by which to displace the legend from the data rectangle and axes.

Default value: 18.

pub fn orient<VALUE: Into<LegendOrient>>(&mut self, value: VALUE) -> &mut Self[src]

The orientation of the legend, which determines how the legend is positioned within the scene. One of "left", "right", "top", "bottom", "top-left", "top-right", "bottom-left", "bottom-right", "none".

Default value: "right"

pub fn padding<VALUE: Into<f64>>(&mut self, value: VALUE) -> &mut Self[src]

The padding between the border and content of the legend group.

Default value: 0.

pub fn row_padding<VALUE: Into<f64>>(&mut self, value: VALUE) -> &mut Self[src]

The vertical padding in pixels between symbol legend entries.

Default value: 2.

pub fn stroke_color<VALUE: Into<String>>(&mut self, value: VALUE) -> &mut Self[src]

Border stroke color for the full legend.

pub fn symbol_dash<VALUE: Into<Vec<f64>>>(&mut self, value: VALUE) -> &mut Self[src]

An array of alternating [stroke, space] lengths for dashed symbol strokes.

pub fn symbol_dash_offset<VALUE: Into<f64>>(
    &mut self,
    value: VALUE
) -> &mut Self
[src]

The pixel offset at which to start drawing with the symbol stroke dash array.

pub fn symbol_fill_color<VALUE: Into<String>>(
    &mut self,
    value: VALUE
) -> &mut Self
[src]

The color of the legend symbol,

pub fn symbol_offset<VALUE: Into<f64>>(&mut self, value: VALUE) -> &mut Self[src]

Horizontal pixel offset for legend symbols.

Default value: 0.

pub fn symbol_opacity<VALUE: Into<f64>>(&mut self, value: VALUE) -> &mut Self[src]

Opacity of the legend symbols.

pub fn symbol_size<VALUE: Into<f64>>(&mut self, value: VALUE) -> &mut Self[src]

The size of the legend symbol, in pixels.

Default value: 100.

pub fn symbol_stroke_color<VALUE: Into<String>>(
    &mut self,
    value: VALUE
) -> &mut Self
[src]

Stroke color for legend symbols.

pub fn symbol_stroke_width<VALUE: Into<f64>>(
    &mut self,
    value: VALUE
) -> &mut Self
[src]

The width of the symbol's stroke.

Default value: 1.5.

pub fn symbol_type<VALUE: Into<String>>(&mut self, value: VALUE) -> &mut Self[src]

The symbol shape. One of the plotting shapes circle (default), square, cross, diamond, triangle-up, triangle-down, triangle-right, or triangle-left, the line symbol stroke, or one of the centered directional shapes arrow, wedge, or triangle. Alternatively, a custom SVG path string can be provided. For correct sizing, custom shape paths should be defined within a square bounding box with coordinates ranging from -1 to 1 along both the x and y dimensions.

Default value: "circle".

pub fn tick_count<VALUE: Into<f64>>(&mut self, value: VALUE) -> &mut Self[src]

The desired number of tick values for quantitative legends.

pub fn tick_min_step<VALUE: Into<f64>>(&mut self, value: VALUE) -> &mut Self[src]

The minimum desired step between legend ticks, in terms of scale domain values. For example, a value of 1 indicates that ticks should not be less than 1 unit apart. If tickMinStep is specified, the tickCount value will be adjusted, if necessary, to enforce the minimum step value.

Default value: undefined

pub fn title<VALUE: Into<RemovableValue<String>>>(
    &mut self,
    value: VALUE
) -> &mut Self
[src]

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.

pub fn title_align<VALUE: Into<Align>>(&mut self, value: VALUE) -> &mut Self[src]

Horizontal text alignment for legend titles.

Default value: "left".

pub fn title_anchor<VALUE: Into<TitleAnchor>>(
    &mut self,
    value: VALUE
) -> &mut Self
[src]

Text anchor position for placing legend titles.

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

Vertical text baseline for legend titles.

Default value: "top".

pub fn title_color<VALUE: Into<String>>(&mut self, value: VALUE) -> &mut Self[src]

The color of the legend title, can be in hex color code or regular color name.

pub fn title_font<VALUE: Into<String>>(&mut self, value: VALUE) -> &mut Self[src]

The font of the legend title.

pub fn title_font_size<VALUE: Into<f64>>(&mut self, value: VALUE) -> &mut Self[src]

The font size of the legend title.

pub fn title_font_style<VALUE: Into<String>>(
    &mut self,
    value: VALUE
) -> &mut Self
[src]

The font style of the legend title.

pub fn title_font_weight<VALUE: Into<FontWeight>>(
    &mut self,
    value: VALUE
) -> &mut Self
[src]

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

pub fn title_limit<VALUE: Into<f64>>(&mut self, value: VALUE) -> &mut Self[src]

Maximum allowed pixel width of legend titles.

Default value: 180.

pub fn title_opacity<VALUE: Into<f64>>(&mut self, value: VALUE) -> &mut Self[src]

Opacity of the legend title.

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

Orientation of the legend title.

pub fn title_padding<VALUE: Into<f64>>(&mut self, value: VALUE) -> &mut Self[src]

The padding, in pixels, between title and legend.

Default value: 5.

pub fn legend_type<VALUE: Into<LegendType>>(
    &mut self,
    value: VALUE
) -> &mut Self
[src]

The type of the legend. Use "symbol" to create a discrete legend and "gradient" for a continuous color gradient.

Default value: "gradient" for non-binned quantitative fields and temporal fields; "symbol" otherwise.

pub fn values<VALUE: Into<Vec<SelectionInitIntervalElement>>>(
    &mut self,
    value: VALUE
) -> &mut Self
[src]

Explicitly set the visible legend values.

pub fn zindex<VALUE: Into<f64>>(&mut self, value: VALUE) -> &mut Self[src]

A non-negative integer indicating the z-index of the legend. If zindex is 0, legend should be drawn behind all chart elements. To put them in front, use zindex = 1.

pub fn build(&self) -> Result<Legend, String>[src]

Builds a new Legend.

Errors

If a required field has not been initialized.

Trait Implementations

impl Clone for LegendBuilder[src]

impl Default for LegendBuilder[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.