Skip to content

grafit-charts


Interface: LegendOptions ​

Extends ​

Properties ​

avoidCaptions? ​

optional avoidCaptions?: boolean

Floating only: make the title and subtitle flow around the legend box instead of running underneath it (true by default). Set to false to allow the overlap.


background? ​

optional background?: LegendBackgroundOptions

Panel behind the items.


data? ​

optional data?: LegendItemOptions[]

Custom items; fully replaces the auto-derived series items.


enabled? ​

optional enabled?: boolean

Inherited from ​

Switchable.enabled


extraItems? ​

optional extraItems?: LegendItemOptions[]

Items appended after the series items (or after data) instead of replacing them — e.g. the colour a conditional itemStyler rule paints with. They stay at the end under reverse too.


floating? ​

optional floating?: boolean

Overlay the whole chart area (CSS position:absolute style) instead of reserving space.


item? ​

optional item?: LegendItemStyleOptions

Styling shared by all items.


maxHeight? ​

optional maxHeight?: Length

Height the legend never goes past, in pixels or as a percentage of the room it was offered ('30%'): rows beyond it are paginated. On a horizontal legend this caps the rows per page along with maxRows, on a vertical one the items per page.


maxRows? ​

optional maxRows?: number

Rows per page for a horizontal legend; 2 by default. A vertical one pages by height.


maxWidth? ​

optional maxWidth?: Length

Width the legend never goes past, in pixels or as a percentage of the room it was offered ('40%'). A vertical legend (left/right) is what this is usually for — it stops long names from eating the plot, and a label that no longer fits is cut with an ellipsis. A horizontal one wraps within it instead.


offset? ​

optional offset?: object

Floating only: inset from the anchored edges; along a centered axis — a shift right/down.

x? ​

optional x?: number

y? ​

optional y?: number


position? ​

optional position?: LegendPlacement

The docking side (first token) plus an optional alignment along it: 'top-right' docks to the top edge, right-aligned ('top' centers). With floating: true the same value anchors the legend over the chart.


reverse? ​

optional reverse?: boolean

Renders the items back to front.


toggleSeries? ​

optional toggleSeries?: boolean

Clicking an item toggles series visibility (true by default).