Interface: LegendOptions<TType>

    Alignment of the legend.

    default ‘center’

    Defined in

    index.esm.d.ts:2274 (opens new window)


    display

    display: boolean

    Is the legend shown?

    default true

    Defined in


    fullSize

    fullSize: boolean

    Marks that this box should take the full width/height of the canvas (moving other boxes). This is unlikely to need to be changed in day-to-day use.

    default true

    Defined in

    index.esm.d.ts:2287 (opens new window)


    labels

    labels: Object

    Type declaration

    NameTypeDescription
    boxHeightnumberHeight of the coloured box. default fontSize
    boxPaddingnumberPadding between the color box and the text default 1
    boxWidthnumberWidth of colored box. default 40
    colorColor of label see Defaults.color
    fontScriptableAndScriptableOptions<Partial<>, ScriptableChartContext>Font of label see Defaults.font
    paddingnumberPadding between rows of colored boxes. default 10
    pointStyleOverride point style for the legend. Only applies if usePointStyle is true
    textAlign?TextAlignText alignment
    usePointStylebooleanLabel style will match corresponding point style (size is based on the minimum value between boxWidth and font.size). default false
    filter(item: , data: ChartData<keyof , ( | ScatterDataPoint | )[], unknown>) => boolean-
    generateLabels(chart: Chart<keyof , (number | ScatterDataPoint | )[], unknown>) => LegendItem[]-
    sort(a: , b: LegendItem, data: <keyof ChartTypeRegistry, (number | | BubbleDataPoint)[], unknown>) => number-

    Defined in

    index.esm.d.ts:2306LegendOptions - 图4 (opens new window)


    maxHeight: number

    Maximum height of the legend, in pixels

    Defined in


    maxWidth

    maxWidth: number

    Maximum width of the legend, in pixels

    Defined in


    position

    position:

    Position of the legend.

    default ‘top’

    Defined in


    reverse

    reverse: boolean

    Legend will show datasets in reverse order.

    default false

    Defined in

    index.esm.d.ts:2292 (opens new window)


    rtl: boolean

    true for rendering the legends from right to left.

    Defined in


    textDirection

    textDirection: string

    default canvas’ default

    Defined in

    index.esm.d.ts:2376 (opens new window)


    title

    title: Object

    Type declaration

    Defined in

    index.esm.d.ts:2378LegendOptions - 图11 (opens new window)

    onClick

    onClick(e, legendItem, legend): void

    A callback that is called when a click event is registered on a label item.

    Parameters

    NameType
    eChartEvent
    legendItem
    legendLegendElement<TType>

    Returns

    void

    Defined in


    onHover(e, legendItem, legend): void

    A callback that is called when a ‘mousemove’ event is registered on top of a label item

    Parameters

    Returns

    void

    Defined in

    index.esm.d.ts:2300LegendOptions - 图13 (opens new window)


    onLeave

    onLeave(e, legendItem, legend): void

    A callback that is called when a ‘mousemove’ event is registered outside of a previously hovered label item.

    Parameters

    NameType
    e
    legendItemLegendItem
    legend<TType>

    Returns

    Defined in