[−][src]Struct vega_lite_3::Legend
Properties of a legend or boolean flag for determining whether to show it.
Fields
clip_height: Option<f64>
The height in pixels to clip symbol legend entries and limit their size.
column_padding: Option<f64>
The horizontal padding in pixels between symbol legend entries.
Default value: 10
.
columns: Option<f64>
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.
corner_radius: Option<f64>
Corner radius for the full legend.
direction: Option<Orientation>
The direction of the legend, one of "vertical"
or "horizontal"
.
Default value:
- For top-/bottom-
orient
ed legends,"horizontal"
- For left-/right-
orient
ed legends,"vertical"
- For top/bottom-left/right-
orient
ed legends,"horizontal"
for gradient legends and"vertical"
for symbol legends.
fill_color: Option<String>
Background fill color for the full legend.
format: Option<String>
The text formatting pattern for labels of guides (axes, legends, headers) and text marks.
- If the format type is
"number"
(e.g., for quantitative fields), this is D3's number format pattern. - If the format type is
"time"
(e.g., for temporal fields), this is D3's time format pattern.
See the format documentation for more examples.
Default value: Derived from numberFormat config for number format and from timeFormat config for time format.
format_type: Option<FormatType>
The format type for labels ("number"
or "time"
).
Default value:
"time"
for temporal fields and ordinal and nomimal fields withtimeUnit
."number"
for quantitative fields as well as ordinal and nomimal fields withouttimeUnit
.
gradient_length: Option<f64>
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
.
gradient_opacity: Option<f64>
Opacity of the color gradient.
gradient_stroke_color: Option<String>
The color of the gradient stroke, can be in hex color code or regular color name.
Default value: "lightGray"
.
gradient_stroke_width: Option<f64>
The width of the gradient stroke, in pixels.
Default value: 0
.
gradient_thickness: Option<f64>
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
.
grid_align: Option<LayoutAlign>
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"
.
label_align: Option<Align>
The alignment of the legend label, can be left, center, or right.
label_baseline: Option<TextBaseline>
The position of the baseline of legend label, can be "top"
, "middle"
, "bottom"
, or
"alphabetic"
.
Default value: "middle"
.
label_color: Option<String>
The color of the legend label, can be in hex color code or regular color name.
label_font: Option<String>
The font of the legend label.
label_font_size: Option<f64>
The font size of legend label.
Default value: 10
.
label_font_style: Option<String>
The font style of legend label.
label_font_weight: Option<FontWeight>
The font weight of legend label.
label_limit: Option<f64>
Maximum allowed pixel width of legend tick labels.
Default value: 160
.
label_offset: Option<f64>
The offset of the legend label.
label_opacity: Option<f64>
Opacity of labels.
label_overlap: Option<LabelOverlap>
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
.
label_padding: Option<f64>
Padding in pixels between the legend and legend labels.
label_separation: Option<f64>
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.
legend_x: Option<f64>
Custom x-position for legend with orient "none".
legend_y: Option<f64>
Custom y-position for legend with orient "none".
offset: Option<f64>
The offset in pixels by which to displace the legend from the data rectangle and axes.
Default value: 18
.
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<f64>
The padding between the border and content of the legend group.
Default value: 0
.
row_padding: Option<f64>
The vertical padding in pixels between symbol legend entries.
Default value: 2
.
stroke_color: Option<String>
Border stroke color for the full legend.
symbol_dash: Option<Vec<f64>>
An array of alternating [stroke, space] lengths for dashed symbol strokes.
symbol_dash_offset: Option<f64>
The pixel offset at which to start drawing with the symbol stroke dash array.
symbol_fill_color: Option<String>
The color of the legend symbol,
symbol_offset: Option<f64>
Horizontal pixel offset for legend symbols.
Default value: 0
.
symbol_opacity: Option<f64>
Opacity of the legend symbols.
symbol_size: Option<f64>
The size of the legend symbol, in pixels.
Default value: 100
.
symbol_stroke_color: Option<String>
Stroke color for legend symbols.
symbol_stroke_width: Option<f64>
The width of the symbol's stroke.
Default value: 1.5
.
symbol_type: Option<String>
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"
.
tick_count: Option<f64>
The desired number of tick values for quantitative legends.
tick_min_step: Option<f64>
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<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:
-
You can customize the default field title format by providing the
fieldTitle
property in the config orfieldTitle
function via thecompile
function's options. -
If both field definition's
title
and axis, header, or legendtitle
are defined, axis/header/legend title will be used.
title_align: Option<Align>
Horizontal text alignment for legend titles.
Default value: "left"
.
title_anchor: Option<TitleAnchor>
Text anchor position for placing legend titles.
title_baseline: Option<TextBaseline>
Vertical text baseline for legend titles.
Default value: "top"
.
title_color: Option<String>
The color of the legend title, can be in hex color code or regular color name.
title_font: Option<String>
The font of the legend title.
title_font_size: Option<f64>
The font size of the legend title.
title_font_style: Option<String>
The font style of the legend title.
title_font_weight: Option<FontWeight>
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
).
title_limit: Option<f64>
Maximum allowed pixel width of legend titles.
Default value: 180
.
title_opacity: Option<f64>
Opacity of the legend title.
title_orient: Option<Orient>
Orientation of the legend title.
title_padding: Option<f64>
The padding, in pixels, between title and legend.
Default value: 5
.
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<SelectionInitIntervalElement>>
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]
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
[src]
__D: Deserializer<'de>,
impl Serialize for Legend
[src]
Auto Trait Implementations
impl RefUnwindSafe for Legend
impl Send for Legend
impl Sync for Legend
impl Unpin for Legend
impl UnwindSafe for Legend
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> DeserializeOwned for T where
T: Deserialize<'de>,
[src]
T: Deserialize<'de>,
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,