Skip to main content

LegendSpec

Options for a chart legend.

Properties

align?

optional align: "center" | "left" | "right"

How to align the content of the legend. Defaults to center align.


floating?

optional floating: boolean

Defaults to false, meaning the legend is positioned inline with the chart. When this is set to true, the legend can be floated anywhere in the chart (for which you need to provide values for x and y).


font?

optional font: FontSpec

Optional font specification for the legend.


hide?

optional hide: boolean

Defaults to false. If true, the legend will not be shown.


hideForSingleSeries?

optional hideForSingleSeries: boolean

Defaults to true: when there is a single series in the chart, the legend is not drawn. Set this to false to override that behaviour.


hover?

optional hover: boolean

Defaults to true - when user hovers over a series in the legend, the series is highlighted in the chart


orientation?

optional orientation: "horizontal" | "vertical"

Defaults to vertical. The orientation in which to align the items.


padding?

optional padding: number

When not floating, padding to draw around the legend.


valign?

optional valign: "top" | "bottom" | "middle"

Where to position the legend vertically (when floating is false). Defaults to bottom; you can choose to place the legend at the top (underneath the title), or to the left/right of the chart area.


x?

optional x: number

When floating is true, the X position of the legend.


y?

optional y: number

When floating is true, the Y position of the legend.