Skip to main content

LegendSpec

Defines legend settings for all chart types

Props

showLegend

  • Type: showLegend: boolean
  • Default: false

Show the legend

legendPosition

  • Type: legendPosition: Position | LegendPositionConfig
  • Default: Position.Right

Set legend position

showLegendExtra

  • Type: showLegendExtra: boolean
  • Default: false

Show an extra parameter on each legend item defined by the chart type

legendMaxDepth

  • Type: legendMaxDepth: number

Limit the legend to the specified maximal depth when showing a hierarchical legend

info

This is not the max depth, but the number of level shown: 0 none, 1 first, 2 up to the second etc. See #1981 for details

legendSize

  • Type: legendSize: number
  • Unit: pixel

Sets the exact legend width (vertical) or height (horizontal).

info

All legends limited to max of 70% of the chart container dimension. Vertical legends limited to min of 30% of computed width

flatLegend

  • Type: flatLegend?: boolean
  • Default: false

Display the legend as a flat list.

info

This option only applies to hierarchical legend such as a multi-layer Partition spec.

legendStrategy

  • Type: legendStrategy?: LegendStrategy
  • Default: LegendStrategy.Path

Choose a partition highlighting strategy for hovering over legend items.

onLegendItemOver

  • Type: onLegendItemOver?: LegendItemListener

onLegendItemOut

  • Type: onLegendItemOut?: BasicListener

onLegendItemClick

  • Type: onLegendItemClick?: LegendItemListener

onLegendItemPlusClick

  • Type: onLegendItemPlusClick?: LegendItemListener

onLegendItemMinusClick

  • Type: onLegendItemMinusClick?: LegendItemListener

legendAction

  • Type: legendAction?: LegendAction

Render slot to render action for legend.

legendColorPicker

  • Type: legendColorPicker?: LegendColorPicker

legendSort

  • Type: legendSort?: SeriesCompareFn

A SeriesSortFn to sort the legend values (top-bottom)

customLegend

  • Type: customLegend?: CustomLegend

Override the legend with a custom component.