Information used for rendering the legend.

Hierarchy

Properties

addEntriesAutomatically?: boolean

Whether legend entries should be automatically added and displayed.

Defaults to true for default legend and false for manually added legends (chart.addLegend).

autoHideThreshold?: number

The maximum allowed proportion of the viewport that the legend can occupy before it is automatically hidden. For example, a value of 0.75 means the legend will be hidden if it covers more than 75% of the viewport.

backgroundEvents: Eventer<LCJSInteractionEventMap, any>

Events for the legend background.

backgroundFillStyle?: FillStyle

Background FillStyle of the legend.

backgroundStrokeStyle?: LineStyle

Background LineStyle of the legend.

backgroundVisible?: boolean

Whether the legend background should be visible.

chartPadding: Margin

Chart padding, used for adjusting the legend position.

chartTitleSpace: Margin

Space allocated for the chart title, used for adjusting the legend position.

entries: LegendEntry[]

Array of legend entries.

entryMargin?: number

Margin between legend entries.

marginInner?: number

Margin from the main chart element to the legend.

marginOuter: Margin

Margin from the legend to the edge of the chart area.

orientation?: LegendOrientation

Legend orientation. By default, this is automatically dictated by configured position But it can be forced to a specific value, which can be useful when positioning legends at arbitrary locations.

 // Example syntax, arbitrary location
chart.legend.setOptions({
position: {
x: 0,
y: 0,
origin: UIOrigins.UIOrigins.LeftBottom
},
orientation: LegendOrientation.Horizontal
})
padding?: Margin

Legend content padding.

position: LegendPosition | {
    origin?: Point;
    x: number;
    y: number;
}

Position of the legend. If x and y are provided, they will be interpreted as relative coordinates of the chart bottom left (chart.coordsRelative). If origin is provided, it will be interpreted as the origin of the legend position.

renderOnTop?: boolean

Whether the legend should be rendered on top of the chart.

title?: string

Title of the legend.

titleEvents: Eventer<LCJSInteractionEventMap, any>

Events for the legend title.

titleFillStyle?: FillStyle

FillStyle of the legend title.

titleFont?: Partial<FontSettings>

FontSettings of the legend title.

visible?: boolean

Whether the legend should be visible.