Add legend to encoding
legend_encoding.Rd
Add legend parameters to an encoding
Usage
vl_legend_angle(
spec,
aria = NULL,
clipHeight = NULL,
columnPadding = NULL,
columns = NULL,
cornerRadius = NULL,
description = NULL,
direction = NULL,
fillColor = NULL,
format = NULL,
formatType = NULL,
gradientLength = NULL,
gradientOpacity = NULL,
gradientStrokeColor = NULL,
gradientStrokeWidth = NULL,
gradientThickness = NULL,
gridAlign = NULL,
labelAlign = NULL,
labelBaseline = NULL,
labelColor = NULL,
labelExpr = NULL,
labelFont = NULL,
labelFontSize = NULL,
labelFontStyle = NULL,
labelFontWeight = NULL,
labelLimit = NULL,
labelOffset = NULL,
labelOpacity = NULL,
labelOverlap = NULL,
labelPadding = NULL,
labelSeparation = NULL,
legendX = NULL,
legendY = NULL,
offset = NULL,
orient = NULL,
padding = NULL,
rowPadding = NULL,
strokeColor = NULL,
symbolDash = NULL,
symbolDashOffset = NULL,
symbolFillColor = NULL,
symbolLimit = NULL,
symbolOffset = NULL,
symbolOpacity = NULL,
symbolSize = NULL,
symbolStrokeColor = NULL,
symbolStrokeWidth = NULL,
symbolType = NULL,
tickCount = NULL,
tickMinStep = NULL,
title = NULL,
titleAlign = NULL,
titleAnchor = NULL,
titleBaseline = NULL,
titleColor = NULL,
titleFont = NULL,
titleFontSize = NULL,
titleFontStyle = NULL,
titleFontWeight = NULL,
titleLimit = NULL,
titleLineHeight = NULL,
titleOpacity = NULL,
titleOrient = NULL,
titlePadding = NULL,
type = NULL,
values = NULL,
zindex = NULL,
.object = NULL
)
vl_legend_color(
spec,
aria = NULL,
clipHeight = NULL,
columnPadding = NULL,
columns = NULL,
cornerRadius = NULL,
description = NULL,
direction = NULL,
fillColor = NULL,
format = NULL,
formatType = NULL,
gradientLength = NULL,
gradientOpacity = NULL,
gradientStrokeColor = NULL,
gradientStrokeWidth = NULL,
gradientThickness = NULL,
gridAlign = NULL,
labelAlign = NULL,
labelBaseline = NULL,
labelColor = NULL,
labelExpr = NULL,
labelFont = NULL,
labelFontSize = NULL,
labelFontStyle = NULL,
labelFontWeight = NULL,
labelLimit = NULL,
labelOffset = NULL,
labelOpacity = NULL,
labelOverlap = NULL,
labelPadding = NULL,
labelSeparation = NULL,
legendX = NULL,
legendY = NULL,
offset = NULL,
orient = NULL,
padding = NULL,
rowPadding = NULL,
strokeColor = NULL,
symbolDash = NULL,
symbolDashOffset = NULL,
symbolFillColor = NULL,
symbolLimit = NULL,
symbolOffset = NULL,
symbolOpacity = NULL,
symbolSize = NULL,
symbolStrokeColor = NULL,
symbolStrokeWidth = NULL,
symbolType = NULL,
tickCount = NULL,
tickMinStep = NULL,
title = NULL,
titleAlign = NULL,
titleAnchor = NULL,
titleBaseline = NULL,
titleColor = NULL,
titleFont = NULL,
titleFontSize = NULL,
titleFontStyle = NULL,
titleFontWeight = NULL,
titleLimit = NULL,
titleLineHeight = NULL,
titleOpacity = NULL,
titleOrient = NULL,
titlePadding = NULL,
type = NULL,
values = NULL,
zindex = NULL,
.object = NULL
)
vl_legend_fill(
spec,
aria = NULL,
clipHeight = NULL,
columnPadding = NULL,
columns = NULL,
cornerRadius = NULL,
description = NULL,
direction = NULL,
fillColor = NULL,
format = NULL,
formatType = NULL,
gradientLength = NULL,
gradientOpacity = NULL,
gradientStrokeColor = NULL,
gradientStrokeWidth = NULL,
gradientThickness = NULL,
gridAlign = NULL,
labelAlign = NULL,
labelBaseline = NULL,
labelColor = NULL,
labelExpr = NULL,
labelFont = NULL,
labelFontSize = NULL,
labelFontStyle = NULL,
labelFontWeight = NULL,
labelLimit = NULL,
labelOffset = NULL,
labelOpacity = NULL,
labelOverlap = NULL,
labelPadding = NULL,
labelSeparation = NULL,
legendX = NULL,
legendY = NULL,
offset = NULL,
orient = NULL,
padding = NULL,
rowPadding = NULL,
strokeColor = NULL,
symbolDash = NULL,
symbolDashOffset = NULL,
symbolFillColor = NULL,
symbolLimit = NULL,
symbolOffset = NULL,
symbolOpacity = NULL,
symbolSize = NULL,
symbolStrokeColor = NULL,
symbolStrokeWidth = NULL,
symbolType = NULL,
tickCount = NULL,
tickMinStep = NULL,
title = NULL,
titleAlign = NULL,
titleAnchor = NULL,
titleBaseline = NULL,
titleColor = NULL,
titleFont = NULL,
titleFontSize = NULL,
titleFontStyle = NULL,
titleFontWeight = NULL,
titleLimit = NULL,
titleLineHeight = NULL,
titleOpacity = NULL,
titleOrient = NULL,
titlePadding = NULL,
type = NULL,
values = NULL,
zindex = NULL,
.object = NULL
)
vl_legend_fillOpacity(
spec,
aria = NULL,
clipHeight = NULL,
columnPadding = NULL,
columns = NULL,
cornerRadius = NULL,
description = NULL,
direction = NULL,
fillColor = NULL,
format = NULL,
formatType = NULL,
gradientLength = NULL,
gradientOpacity = NULL,
gradientStrokeColor = NULL,
gradientStrokeWidth = NULL,
gradientThickness = NULL,
gridAlign = NULL,
labelAlign = NULL,
labelBaseline = NULL,
labelColor = NULL,
labelExpr = NULL,
labelFont = NULL,
labelFontSize = NULL,
labelFontStyle = NULL,
labelFontWeight = NULL,
labelLimit = NULL,
labelOffset = NULL,
labelOpacity = NULL,
labelOverlap = NULL,
labelPadding = NULL,
labelSeparation = NULL,
legendX = NULL,
legendY = NULL,
offset = NULL,
orient = NULL,
padding = NULL,
rowPadding = NULL,
strokeColor = NULL,
symbolDash = NULL,
symbolDashOffset = NULL,
symbolFillColor = NULL,
symbolLimit = NULL,
symbolOffset = NULL,
symbolOpacity = NULL,
symbolSize = NULL,
symbolStrokeColor = NULL,
symbolStrokeWidth = NULL,
symbolType = NULL,
tickCount = NULL,
tickMinStep = NULL,
title = NULL,
titleAlign = NULL,
titleAnchor = NULL,
titleBaseline = NULL,
titleColor = NULL,
titleFont = NULL,
titleFontSize = NULL,
titleFontStyle = NULL,
titleFontWeight = NULL,
titleLimit = NULL,
titleLineHeight = NULL,
titleOpacity = NULL,
titleOrient = NULL,
titlePadding = NULL,
type = NULL,
values = NULL,
zindex = NULL,
.object = NULL
)
vl_legend_opacity(
spec,
aria = NULL,
clipHeight = NULL,
columnPadding = NULL,
columns = NULL,
cornerRadius = NULL,
description = NULL,
direction = NULL,
fillColor = NULL,
format = NULL,
formatType = NULL,
gradientLength = NULL,
gradientOpacity = NULL,
gradientStrokeColor = NULL,
gradientStrokeWidth = NULL,
gradientThickness = NULL,
gridAlign = NULL,
labelAlign = NULL,
labelBaseline = NULL,
labelColor = NULL,
labelExpr = NULL,
labelFont = NULL,
labelFontSize = NULL,
labelFontStyle = NULL,
labelFontWeight = NULL,
labelLimit = NULL,
labelOffset = NULL,
labelOpacity = NULL,
labelOverlap = NULL,
labelPadding = NULL,
labelSeparation = NULL,
legendX = NULL,
legendY = NULL,
offset = NULL,
orient = NULL,
padding = NULL,
rowPadding = NULL,
strokeColor = NULL,
symbolDash = NULL,
symbolDashOffset = NULL,
symbolFillColor = NULL,
symbolLimit = NULL,
symbolOffset = NULL,
symbolOpacity = NULL,
symbolSize = NULL,
symbolStrokeColor = NULL,
symbolStrokeWidth = NULL,
symbolType = NULL,
tickCount = NULL,
tickMinStep = NULL,
title = NULL,
titleAlign = NULL,
titleAnchor = NULL,
titleBaseline = NULL,
titleColor = NULL,
titleFont = NULL,
titleFontSize = NULL,
titleFontStyle = NULL,
titleFontWeight = NULL,
titleLimit = NULL,
titleLineHeight = NULL,
titleOpacity = NULL,
titleOrient = NULL,
titlePadding = NULL,
type = NULL,
values = NULL,
zindex = NULL,
.object = NULL
)
vl_legend_shape(
spec,
aria = NULL,
clipHeight = NULL,
columnPadding = NULL,
columns = NULL,
cornerRadius = NULL,
description = NULL,
direction = NULL,
fillColor = NULL,
format = NULL,
formatType = NULL,
gradientLength = NULL,
gradientOpacity = NULL,
gradientStrokeColor = NULL,
gradientStrokeWidth = NULL,
gradientThickness = NULL,
gridAlign = NULL,
labelAlign = NULL,
labelBaseline = NULL,
labelColor = NULL,
labelExpr = NULL,
labelFont = NULL,
labelFontSize = NULL,
labelFontStyle = NULL,
labelFontWeight = NULL,
labelLimit = NULL,
labelOffset = NULL,
labelOpacity = NULL,
labelOverlap = NULL,
labelPadding = NULL,
labelSeparation = NULL,
legendX = NULL,
legendY = NULL,
offset = NULL,
orient = NULL,
padding = NULL,
rowPadding = NULL,
strokeColor = NULL,
symbolDash = NULL,
symbolDashOffset = NULL,
symbolFillColor = NULL,
symbolLimit = NULL,
symbolOffset = NULL,
symbolOpacity = NULL,
symbolSize = NULL,
symbolStrokeColor = NULL,
symbolStrokeWidth = NULL,
symbolType = NULL,
tickCount = NULL,
tickMinStep = NULL,
title = NULL,
titleAlign = NULL,
titleAnchor = NULL,
titleBaseline = NULL,
titleColor = NULL,
titleFont = NULL,
titleFontSize = NULL,
titleFontStyle = NULL,
titleFontWeight = NULL,
titleLimit = NULL,
titleLineHeight = NULL,
titleOpacity = NULL,
titleOrient = NULL,
titlePadding = NULL,
type = NULL,
values = NULL,
zindex = NULL,
.object = NULL
)
vl_legend_size(
spec,
aria = NULL,
clipHeight = NULL,
columnPadding = NULL,
columns = NULL,
cornerRadius = NULL,
description = NULL,
direction = NULL,
fillColor = NULL,
format = NULL,
formatType = NULL,
gradientLength = NULL,
gradientOpacity = NULL,
gradientStrokeColor = NULL,
gradientStrokeWidth = NULL,
gradientThickness = NULL,
gridAlign = NULL,
labelAlign = NULL,
labelBaseline = NULL,
labelColor = NULL,
labelExpr = NULL,
labelFont = NULL,
labelFontSize = NULL,
labelFontStyle = NULL,
labelFontWeight = NULL,
labelLimit = NULL,
labelOffset = NULL,
labelOpacity = NULL,
labelOverlap = NULL,
labelPadding = NULL,
labelSeparation = NULL,
legendX = NULL,
legendY = NULL,
offset = NULL,
orient = NULL,
padding = NULL,
rowPadding = NULL,
strokeColor = NULL,
symbolDash = NULL,
symbolDashOffset = NULL,
symbolFillColor = NULL,
symbolLimit = NULL,
symbolOffset = NULL,
symbolOpacity = NULL,
symbolSize = NULL,
symbolStrokeColor = NULL,
symbolStrokeWidth = NULL,
symbolType = NULL,
tickCount = NULL,
tickMinStep = NULL,
title = NULL,
titleAlign = NULL,
titleAnchor = NULL,
titleBaseline = NULL,
titleColor = NULL,
titleFont = NULL,
titleFontSize = NULL,
titleFontStyle = NULL,
titleFontWeight = NULL,
titleLimit = NULL,
titleLineHeight = NULL,
titleOpacity = NULL,
titleOrient = NULL,
titlePadding = NULL,
type = NULL,
values = NULL,
zindex = NULL,
.object = NULL
)
vl_legend_stroke(
spec,
aria = NULL,
clipHeight = NULL,
columnPadding = NULL,
columns = NULL,
cornerRadius = NULL,
description = NULL,
direction = NULL,
fillColor = NULL,
format = NULL,
formatType = NULL,
gradientLength = NULL,
gradientOpacity = NULL,
gradientStrokeColor = NULL,
gradientStrokeWidth = NULL,
gradientThickness = NULL,
gridAlign = NULL,
labelAlign = NULL,
labelBaseline = NULL,
labelColor = NULL,
labelExpr = NULL,
labelFont = NULL,
labelFontSize = NULL,
labelFontStyle = NULL,
labelFontWeight = NULL,
labelLimit = NULL,
labelOffset = NULL,
labelOpacity = NULL,
labelOverlap = NULL,
labelPadding = NULL,
labelSeparation = NULL,
legendX = NULL,
legendY = NULL,
offset = NULL,
orient = NULL,
padding = NULL,
rowPadding = NULL,
strokeColor = NULL,
symbolDash = NULL,
symbolDashOffset = NULL,
symbolFillColor = NULL,
symbolLimit = NULL,
symbolOffset = NULL,
symbolOpacity = NULL,
symbolSize = NULL,
symbolStrokeColor = NULL,
symbolStrokeWidth = NULL,
symbolType = NULL,
tickCount = NULL,
tickMinStep = NULL,
title = NULL,
titleAlign = NULL,
titleAnchor = NULL,
titleBaseline = NULL,
titleColor = NULL,
titleFont = NULL,
titleFontSize = NULL,
titleFontStyle = NULL,
titleFontWeight = NULL,
titleLimit = NULL,
titleLineHeight = NULL,
titleOpacity = NULL,
titleOrient = NULL,
titlePadding = NULL,
type = NULL,
values = NULL,
zindex = NULL,
.object = NULL
)
vl_legend_strokeDash(
spec,
aria = NULL,
clipHeight = NULL,
columnPadding = NULL,
columns = NULL,
cornerRadius = NULL,
description = NULL,
direction = NULL,
fillColor = NULL,
format = NULL,
formatType = NULL,
gradientLength = NULL,
gradientOpacity = NULL,
gradientStrokeColor = NULL,
gradientStrokeWidth = NULL,
gradientThickness = NULL,
gridAlign = NULL,
labelAlign = NULL,
labelBaseline = NULL,
labelColor = NULL,
labelExpr = NULL,
labelFont = NULL,
labelFontSize = NULL,
labelFontStyle = NULL,
labelFontWeight = NULL,
labelLimit = NULL,
labelOffset = NULL,
labelOpacity = NULL,
labelOverlap = NULL,
labelPadding = NULL,
labelSeparation = NULL,
legendX = NULL,
legendY = NULL,
offset = NULL,
orient = NULL,
padding = NULL,
rowPadding = NULL,
strokeColor = NULL,
symbolDash = NULL,
symbolDashOffset = NULL,
symbolFillColor = NULL,
symbolLimit = NULL,
symbolOffset = NULL,
symbolOpacity = NULL,
symbolSize = NULL,
symbolStrokeColor = NULL,
symbolStrokeWidth = NULL,
symbolType = NULL,
tickCount = NULL,
tickMinStep = NULL,
title = NULL,
titleAlign = NULL,
titleAnchor = NULL,
titleBaseline = NULL,
titleColor = NULL,
titleFont = NULL,
titleFontSize = NULL,
titleFontStyle = NULL,
titleFontWeight = NULL,
titleLimit = NULL,
titleLineHeight = NULL,
titleOpacity = NULL,
titleOrient = NULL,
titlePadding = NULL,
type = NULL,
values = NULL,
zindex = NULL,
.object = NULL
)
vl_legend_strokeOpacity(
spec,
aria = NULL,
clipHeight = NULL,
columnPadding = NULL,
columns = NULL,
cornerRadius = NULL,
description = NULL,
direction = NULL,
fillColor = NULL,
format = NULL,
formatType = NULL,
gradientLength = NULL,
gradientOpacity = NULL,
gradientStrokeColor = NULL,
gradientStrokeWidth = NULL,
gradientThickness = NULL,
gridAlign = NULL,
labelAlign = NULL,
labelBaseline = NULL,
labelColor = NULL,
labelExpr = NULL,
labelFont = NULL,
labelFontSize = NULL,
labelFontStyle = NULL,
labelFontWeight = NULL,
labelLimit = NULL,
labelOffset = NULL,
labelOpacity = NULL,
labelOverlap = NULL,
labelPadding = NULL,
labelSeparation = NULL,
legendX = NULL,
legendY = NULL,
offset = NULL,
orient = NULL,
padding = NULL,
rowPadding = NULL,
strokeColor = NULL,
symbolDash = NULL,
symbolDashOffset = NULL,
symbolFillColor = NULL,
symbolLimit = NULL,
symbolOffset = NULL,
symbolOpacity = NULL,
symbolSize = NULL,
symbolStrokeColor = NULL,
symbolStrokeWidth = NULL,
symbolType = NULL,
tickCount = NULL,
tickMinStep = NULL,
title = NULL,
titleAlign = NULL,
titleAnchor = NULL,
titleBaseline = NULL,
titleColor = NULL,
titleFont = NULL,
titleFontSize = NULL,
titleFontStyle = NULL,
titleFontWeight = NULL,
titleLimit = NULL,
titleLineHeight = NULL,
titleOpacity = NULL,
titleOrient = NULL,
titlePadding = NULL,
type = NULL,
values = NULL,
zindex = NULL,
.object = NULL
)
vl_legend_strokeWidth(
spec,
aria = NULL,
clipHeight = NULL,
columnPadding = NULL,
columns = NULL,
cornerRadius = NULL,
description = NULL,
direction = NULL,
fillColor = NULL,
format = NULL,
formatType = NULL,
gradientLength = NULL,
gradientOpacity = NULL,
gradientStrokeColor = NULL,
gradientStrokeWidth = NULL,
gradientThickness = NULL,
gridAlign = NULL,
labelAlign = NULL,
labelBaseline = NULL,
labelColor = NULL,
labelExpr = NULL,
labelFont = NULL,
labelFontSize = NULL,
labelFontStyle = NULL,
labelFontWeight = NULL,
labelLimit = NULL,
labelOffset = NULL,
labelOpacity = NULL,
labelOverlap = NULL,
labelPadding = NULL,
labelSeparation = NULL,
legendX = NULL,
legendY = NULL,
offset = NULL,
orient = NULL,
padding = NULL,
rowPadding = NULL,
strokeColor = NULL,
symbolDash = NULL,
symbolDashOffset = NULL,
symbolFillColor = NULL,
symbolLimit = NULL,
symbolOffset = NULL,
symbolOpacity = NULL,
symbolSize = NULL,
symbolStrokeColor = NULL,
symbolStrokeWidth = NULL,
symbolType = NULL,
tickCount = NULL,
tickMinStep = NULL,
title = NULL,
titleAlign = NULL,
titleAnchor = NULL,
titleBaseline = NULL,
titleColor = NULL,
titleFont = NULL,
titleFontSize = NULL,
titleFontStyle = NULL,
titleFontWeight = NULL,
titleLimit = NULL,
titleLineHeight = NULL,
titleOpacity = NULL,
titleOrient = NULL,
titlePadding = NULL,
type = NULL,
values = NULL,
zindex = NULL,
.object = NULL
)
Arguments
- spec
An input vega-lite spec
- aria
A boolean flag indicating if ARIA attributes should be included (SVG output only). If
false
, the "aria-hidden" attribute will be set on the output SVG group, removing the legend from the ARIA accessibility tree.Default value:
true
Or: ExprRef
- clipHeight
The height in pixels to clip symbol legend entries and limit their size.
Or: ExprRef
- columnPadding
The horizontal padding in pixels between symbol legend entries.
Default value:
10
.Or: ExprRef
- columns
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.Or: ExprRef
- cornerRadius
Corner radius for the full legend.
Or: ExprRef
- description
A text description of this legend for ARIA accessibility (SVG output only). If the
aria
property is true, for SVG output the "aria-label" attribute will be set to this description. If the description is unspecified it will be automatically generated.Or: ExprRef
- direction
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.
- fillColor
Background fill color for the full legend.
Or: ExprRef
- 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.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.
When used with a custom
formatType
, this value will be passed asformat
alongsidedatum.value
to the registered function.Default value: Derived from numberFormat config for number format and from timeFormat config for time format.
- formatType
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 withtimeUnit
."number"
for quantitative fields as well as ordinal and nominal fields withouttimeUnit
.
- gradientLength
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
.Or: ExprRef
- gradientOpacity
Opacity of the color gradient.
Or: ExprRef
- gradientStrokeColor
The color of the gradient stroke, can be in hex color code or regular color name.
Default value:
"lightGray"
.Or: ExprRef
- gradientStrokeWidth
The width of the gradient stroke, in pixels.
Default value:
0
.Or: ExprRef
- gradientThickness
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
.Or: ExprRef
- gridAlign
The alignment to apply to symbol legends rows and columns. The supported string values are
"all"
,"each"
(the default), andnone
. For more information, see the grid layout documentation.Default value:
"each"
.Or: ExprRef
- labelAlign
The alignment of the legend label, can be left, center, or right.
Or: ExprRef
- labelBaseline
The position of the baseline of legend label, can be
"top"
,"middle"
,"bottom"
, or"alphabetic"
.Default value:
"middle"
.Or: ExprRef
- labelColor
The color of the legend label, can be in hex color code or regular color name.
Or: ExprRef
- labelExpr
Vega expression for customizing labels.
Note: The label text and value can be assessed via the
label
andvalue
properties of the legend's backingdatum
object.- labelFont
The font of the legend label.
Or: ExprRef
- labelFontSize
The font size of legend label.
Default value:
10
.Or: ExprRef
- labelFontStyle
The font style of legend label.
Or: ExprRef
- labelFontWeight
The font weight of legend label.
Or: ExprRef
- labelLimit
Maximum allowed pixel width of legend tick labels.
Default value:
160
.Or: ExprRef
- labelOffset
The offset of the legend label.
Default value:
4
.Or: ExprRef
- labelOpacity
Opacity of labels.
Or: ExprRef
- labelOverlap
The strategy to use for resolving overlap of labels in gradient legends. If
false
, no overlap reduction is attempted. If set totrue
(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
.Or: ExprRef
- labelPadding
Padding in pixels between the legend and legend labels.
Or: ExprRef
- labelSeparation
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.Or: ExprRef
- legendX
Custom x-position for legend with orient "none".
Or: ExprRef
- legendY
Custom y-position for legend with orient "none".
Or: ExprRef
- offset
The offset in pixels by which to displace the legend from the data rectangle and axes.
Default value:
18
.Or: ExprRef
- orient
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
The padding between the border and content of the legend group.
Default value:
0
.Or: ExprRef
- rowPadding
The vertical padding in pixels between symbol legend entries.
Default value:
2
.Or: ExprRef
- strokeColor
Border stroke color for the full legend.
Or: ExprRef
- symbolDash
An array of alternating [stroke, space] lengths for dashed symbol strokes.
Or: ExprRef
- symbolDashOffset
The pixel offset at which to start drawing with the symbol stroke dash array.
Or: ExprRef
- symbolFillColor
The color of the legend symbol,
Or: ExprRef
- symbolLimit
The maximum number of allowed entries for a symbol legend. Additional entries will be dropped.
Or: ExprRef
- symbolOffset
Horizontal pixel offset for legend symbols.
Default value:
0
.Or: ExprRef
- symbolOpacity
Opacity of the legend symbols.
Or: ExprRef
- symbolSize
The size of the legend symbol, in pixels.
Default value:
100
.Or: ExprRef
- symbolStrokeColor
Stroke color for legend symbols.
Or: ExprRef
- symbolStrokeWidth
The width of the symbol's stroke.
Default value:
1.5
.Or: ExprRef
- symbolType
The symbol shape. One of the plotting shapes
circle
(default),square
,cross
,diamond
,triangle-up
,triangle-down
,triangle-right
, ortriangle-left
, the line symbolstroke
, or one of the centered directional shapesarrow
,wedge
, ortriangle
. 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"
.Or: ExprRef
- tickCount
The desired number of tick values for quantitative legends.
Or: ExprRef
- tickMinStep
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. IftickMinStep
is specified, thetickCount
value will be adjusted, if necessary, to enforce the minimum step value.Default value:
undefined
- title
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
andtimeUnit
). 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.
- titleAlign
Horizontal text alignment for legend titles.
Default value:
"left"
.Or: ExprRef
- titleAnchor
Text anchor position for placing legend titles.
Or: ExprRef
- titleBaseline
Vertical text baseline for legend titles. 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 lineHeight rather than fontSize alone.Default value:
"top"
.Or: ExprRef
- titleColor
The color of the legend title, can be in hex color code or regular color name.
Or: ExprRef
- titleFont
The font of the legend title.
Or: ExprRef
- titleFontSize
The font size of the legend title.
Or: ExprRef
- titleFontStyle
The font style of the legend title.
Or: ExprRef
- titleFontWeight
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
).Or: ExprRef
- titleLimit
Maximum allowed pixel width of legend titles.
Default value:
180
.Or: ExprRef
- titleLineHeight
Line height in pixels for multi-line title text or title text with
"line-top"
or"line-bottom"
baseline.Or: ExprRef
- titleOpacity
Opacity of the legend title.
Or: ExprRef
- titleOrient
Orientation of the legend title.
Or: ExprRef
- titlePadding
The padding, in pixels, between title and legend.
Default value:
5
.Or: ExprRef
- type
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
Explicitly set the visible legend values.
- zindex
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.
- .object
Directly input an object, rather than creating one via the other arguments. Should not be used in conjunction with the other arguments other than
spec
. Objects can be of type: Legend