Options
All
  • Public
  • Public/Protected
  • All
Menu

Interface LegendOptions

Hierarchy

  • LegendOptions

Index

Properties

Optional align

align?: "center" | "start" | "end"

Alignment of the legend.

default

'center'

Optional display

display?: boolean

Is the legend shown?

default

true

Optional 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

Optional labels

labels?: { boxHeight?: number; boxPadding?: number; boxWidth?: number; color?: CHARTJS.Color; filter?: ScriptableFunction<boolean>; font?: FontSpec; generateLabels?: ScriptableFunction<LegendItem[]>; padding?: number; pointStyle?: PointStyle; sort?: ScriptableFunction<number>; textAlign?: TextAlign; usePointStyle?: boolean }

Type declaration

  • Optional boxHeight?: number

    Height of the coloured box.

    default

    fontSize

  • Optional boxPadding?: number

    Padding between the color box and the text

    default

    1

  • Optional boxWidth?: number

    Width of colored box.

    default

    40

  • Optional color?: CHARTJS.Color

    Color of label

    see

    Defaults.color

  • Optional filter?: ScriptableFunction<boolean>

    Filters legend items out of the legend. Receives 2 parameters, a Legend Item and the chart data

  • Optional font?: FontSpec

    Font of label

    see

    Defaults.font

  • Optional generateLabels?: ScriptableFunction<LegendItem[]>

    Generates legend items for each thing in the legend. Default implementation returns the text + styling for the color box. See Legend Item for details.

  • Optional padding?: number

    Padding between rows of colored boxes.

    default

    10

  • Optional pointStyle?: PointStyle

    Override point style for the legend. Only applies if usePointStyle is true

  • Optional sort?: ScriptableFunction<number>

    Sorts the legend items

  • Optional textAlign?: TextAlign

    Text alignment

  • Optional usePointStyle?: boolean

    Label style will match corresponding point style (size is based on the minimum value between boxWidth and font.size).

    default

    false

Optional maxHeight

maxHeight?: number

Maximum height of the legend, in pixels

Optional maxWidth

maxWidth?: number

Maximum width of the legend, in pixels

Optional onClick

onClick?: ScriptableFunction<void>

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

Optional onHover

onHover?: ScriptableFunction<void>

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

Optional onLeave

onLeave?: ScriptableFunction<void>

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

Optional position

position?: LayoutPosition

Position of the legend.

default

'top'

Optional reverse

reverse?: boolean

Legend will show datasets in reverse order.

default

false

Optional rtl

rtl?: boolean

true for rendering the legends from right to left.

Optional textDirection

textDirection?: string

This will force the text direction 'rtl' or 'ltr' on the canvas for rendering the legend, regardless of the css specified on the canvas

default

canvas' default

Optional title

title?: { color?: CHARTJS.Color; display?: boolean; font?: FontSpec; padding?: number | ChartArea; position?: "center" | "start" | "end"; text?: string }

Type declaration

  • Optional color?: CHARTJS.Color

    Color of title

    see

    Defaults.color

  • Optional display?: boolean

    Is the legend title displayed.

    default

    false

  • Optional font?: FontSpec

    see Fonts

  • Optional padding?: number | ChartArea
  • Optional position?: "center" | "start" | "end"
  • Optional text?: string

    The string title.

Generated using TypeDoc