Struct vega_lite::Legend

source ·
pub struct Legend {
    pub entry_padding: Option<f64>,
    pub format: Option<String>,
    pub offset: Option<f64>,
    pub orient: Option<LegendOrient>,
    pub padding: Option<f64>,
    pub tick_count: Option<f64>,
    pub title: Option<String>,
    pub legend_type: Option<LegendType>,
    pub values: Option<Vec<SortElement>>,
    pub zindex: Option<f64>,
}
Expand description

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

Fields§

§entry_padding: Option<f64>

Padding (in pixels) between legend entries in a symbol legend.

§format: Option<String>

The formatting pattern for labels. This is D3’s number format pattern for quantitative fields and D3’s time format pattern for time field.

See the format documentation for more information.

Default value: derived from numberFormat config for quantitative fields and from timeFormat config for temporal fields.

§offset: Option<f64>

The offset, in pixels, by which to displace the legend from the edge of the enclosing group or data rectangle.

Default value: 0

§orient: Option<LegendOrient>

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

Default value: "right"

§padding: Option<f64>

The padding, in pixels, between the legend and axis.

§tick_count: Option<f64>

The desired number of tick values for quantitative legends.

§title: Option<String>

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.

§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<Vec<SortElement>>

Explicitly set the visible legend values.

§zindex: Option<f64>

A non-positive integer indicating 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§

Formats the value using the given formatter. Read more
Deserialize this value from the given Serde deserializer. Read more
Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

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

The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.