[][src]Struct vega_lite_4::Legend

pub struct Legend {
    pub aria: Option<Aria>,
    pub clip_height: Option<CornerRadiusUnion>,
    pub column_padding: Option<CornerRadiusUnion>,
    pub columns: Option<CornerRadiusUnion>,
    pub corner_radius: Option<CornerRadiusUnion>,
    pub description: Option<Color>,
    pub direction: Option<Orientation>,
    pub fill_color: Option<Color>,
    pub format: Option<Format>,
    pub format_type: Option<String>,
    pub gradient_length: Option<FontSize>,
    pub gradient_opacity: Option<CornerRadiusUnion>,
    pub gradient_stroke_color: Option<Color>,
    pub gradient_stroke_width: Option<FontSize>,
    pub gradient_thickness: Option<FontSize>,
    pub grid_align: Option<GridAlign>,
    pub label_align: Option<TitleAlignUnion>,
    pub label_baseline: Option<TextBaseline>,
    pub label_color: Option<Color>,
    pub label_expr: Option<String>,
    pub label_font: Option<Color>,
    pub label_font_size: Option<FontSize>,
    pub label_font_style: Option<Color>,
    pub label_font_weight: Option<FontWeightUnion>,
    pub label_limit: Option<CornerRadiusUnion>,
    pub label_offset: Option<CornerRadiusUnion>,
    pub label_opacity: Option<CornerRadiusUnion>,
    pub label_overlap: Option<LabelOverlapUnion>,
    pub label_padding: Option<CornerRadiusUnion>,
    pub label_separation: Option<CornerRadiusUnion>,
    pub legend_x: Option<CornerRadiusUnion>,
    pub legend_y: Option<CornerRadiusUnion>,
    pub offset: Option<CornerRadiusUnion>,
    pub orient: Option<LegendOrient>,
    pub padding: Option<CornerRadiusUnion>,
    pub row_padding: Option<CornerRadiusUnion>,
    pub stroke_color: Option<Color>,
    pub symbol_dash: Option<StrokeDashUnion>,
    pub symbol_dash_offset: Option<CornerRadiusUnion>,
    pub symbol_fill_color: Option<Color>,
    pub symbol_limit: Option<CornerRadiusUnion>,
    pub symbol_offset: Option<CornerRadiusUnion>,
    pub symbol_opacity: Option<CornerRadiusUnion>,
    pub symbol_size: Option<FontSize>,
    pub symbol_stroke_color: Option<Color>,
    pub symbol_stroke_width: Option<FontSize>,
    pub symbol_type: Option<Color>,
    pub tick_count: Option<TickCount>,
    pub tick_min_step: Option<CornerRadiusUnion>,
    pub title: RemovableValue<LegendText>,
    pub title_align: Option<TitleAlignUnion>,
    pub title_anchor: Option<TitleAnchorUnion>,
    pub title_baseline: Option<TextBaseline>,
    pub title_color: Option<Color>,
    pub title_font: Option<Color>,
    pub title_font_size: Option<CornerRadiusUnion>,
    pub title_font_style: Option<Color>,
    pub title_font_weight: Option<FontWeightUnion>,
    pub title_limit: Option<FontSize>,
    pub title_line_height: Option<CornerRadiusUnion>,
    pub title_opacity: Option<CornerRadiusUnion>,
    pub title_orient: Option<TitleOrientUnion>,
    pub title_padding: Option<CornerRadiusUnion>,
    pub legend_type: Option<LegendType>,
    pub values: Option<Values>,
    pub zindex: Option<f64>,
}

Properties of a legend or boolean flag for determining whether to show it.

Fields

aria: Option<Aria>clip_height: Option<CornerRadiusUnion>column_padding: Option<CornerRadiusUnion>columns: Option<CornerRadiusUnion>corner_radius: Option<CornerRadiusUnion>description: Option<Color>direction: Option<Orientation>

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.

fill_color: Option<Color>format: Option<Format>

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.

format_type: Option<String>

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.

gradient_length: Option<FontSize>gradient_opacity: Option<CornerRadiusUnion>gradient_stroke_color: Option<Color>gradient_stroke_width: Option<FontSize>gradient_thickness: Option<FontSize>grid_align: Option<GridAlign>label_align: Option<TitleAlignUnion>label_baseline: Option<TextBaseline>label_color: Option<Color>label_expr: Option<String>

Vega expression for customizing labels.

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

label_font: Option<Color>label_font_size: Option<FontSize>label_font_style: Option<Color>label_font_weight: Option<FontWeightUnion>label_limit: Option<CornerRadiusUnion>label_offset: Option<CornerRadiusUnion>label_opacity: Option<CornerRadiusUnion>label_overlap: Option<LabelOverlapUnion>label_padding: Option<CornerRadiusUnion>label_separation: Option<CornerRadiusUnion>legend_x: Option<CornerRadiusUnion>legend_y: Option<CornerRadiusUnion>offset: Option<CornerRadiusUnion>orient: Option<LegendOrient>

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"

padding: Option<CornerRadiusUnion>row_padding: Option<CornerRadiusUnion>stroke_color: Option<Color>symbol_dash: Option<StrokeDashUnion>symbol_dash_offset: Option<CornerRadiusUnion>symbol_fill_color: Option<Color>symbol_limit: Option<CornerRadiusUnion>symbol_offset: Option<CornerRadiusUnion>symbol_opacity: Option<CornerRadiusUnion>symbol_size: Option<FontSize>symbol_stroke_color: Option<Color>symbol_stroke_width: Option<FontSize>symbol_type: Option<Color>tick_count: Option<TickCount>tick_min_step: Option<CornerRadiusUnion>

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

title: RemovableValue<LegendText>

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.

title_align: Option<TitleAlignUnion>title_anchor: Option<TitleAnchorUnion>title_baseline: Option<TextBaseline>title_color: Option<Color>title_font: Option<Color>title_font_size: Option<CornerRadiusUnion>title_font_style: Option<Color>title_font_weight: Option<FontWeightUnion>title_limit: Option<FontSize>title_line_height: Option<CornerRadiusUnion>title_opacity: Option<CornerRadiusUnion>title_orient: Option<TitleOrientUnion>title_padding: Option<CornerRadiusUnion>legend_type: Option<LegendType>

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.

values: Option<Values>

Explicitly set the visible legend values.

zindex: Option<f64>

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.

Trait Implementations

impl Clone for Legend[src]

impl Debug for Legend[src]

impl Default for Legend[src]

impl<'de> Deserialize<'de> for Legend[src]

impl Serialize for Legend[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> DeserializeOwned for T where
    T: for<'de> Deserialize<'de>, 
[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.