Interface: Plugin<TType, O>

    • Plugin

    id: string

    Defined in: index.esm.d.ts:746 (opens new window)

    afterBuildTicks

    OptionalafterBuildTicks(chart: Chart<bar | line | scatter | bubble | pie | doughnut | polarArea | radar, (number | | BubbleDataPoint)[], unknown>, args: { scale: <CoreScaleOptions> }, options: O): void

    desc Called after scale has build its ticks. This hook is called separately for each scale in the chart.

    Parameters:

    NameTypeDescription
    chartChart<bar | line | scatter | bubble | pie | doughnut | polarArea | radar, (number | | BubbleDataPoint)[], unknown>The chart instance.
    argsobjectThe call arguments.
    args.scale<CoreScaleOptions>The scale.
    optionsOThe plugin options.

    Returns: void

    Defined in:


    afterDataLimits

    OptionalafterDataLimits(chart: <bar | line | scatter | bubble | pie | doughnut | polarArea | radar, (number | ScatterDataPoint | )[], unknown>, args: { scale: Scale<> }, options: O): void

    desc Called after scale data limits are calculated. This hook is called separately for each scale in the chart.

    Parameters:

    NameTypeDescription
    chart<bar | line | scatter | bubble | pie | doughnut | polarArea | radar, (number | ScatterDataPoint | )[], unknown>The chart instance.
    argsobjectThe call arguments.
    args.scaleScale<>The scale.
    optionsOThe plugin options.

    Returns: void

    Defined in: index.esm.d.ts:889 (opens new window)


    afterDatasetDraw

    OptionalafterDatasetDraw(chart: Chart<bar | line | scatter | bubble | pie | doughnut | polarArea | radar, (number | | BubbleDataPoint)[], unknown>, args: { index: number ; meta: <Element<{}, {}>, <{}, {}>> }, options: O): void

    desc Called after the chart datasets at the given args.index have been drawn (datasets are drawn in the reverse order). Note that this hook will not be called if the datasets drawing has been previously cancelled.

    Parameters:

    NameTypeDescription
    chart<bar | line | scatter | bubble | pie | doughnut | polarArea | radar, (number | ScatterDataPoint | )[], unknown>The chart instance.
    argsobjectThe call arguments.
    args.indexnumberThe dataset index.
    args.metaChartMeta<<{}, {}>, Element<{}, {}>>The dataset metadata.
    optionsOThe plugin options.

    Returns: void

    Defined in:


    afterDatasetUpdate

    OptionalafterDatasetUpdate(chart: <bar | line | scatter | bubble | pie | doughnut | polarArea | radar, (number | ScatterDataPoint | )[], unknown>, args: { cancelable: false ; index: number ; meta: ChartMeta<<{}, {}>, Element<{}, {}>> ; mode: resize | reset | none | hide | show | normal | active }, options: O): void

    desc Called after the chart datasets at the given args.index has been updated. Note that this hook will not be called if the datasets update has been previously cancelled.

    Parameters:

    NameTypeDescription
    chartChart<bar | line | scatter | bubble | pie | doughnut | polarArea | radar, (number | | BubbleDataPoint)[], unknown>The chart instance.
    argsobjectThe call arguments.
    args.cancelablefalse-
    args.indexnumberThe dataset index.
    args.meta<Element<{}, {}>, <{}, {}>>The dataset metadata.
    args.moderesize | reset | none | hide | show | normal | activeThe update mode.
    optionsOThe plugin options.

    Returns: void

    Defined in: index.esm.d.ts:864 (opens new window)


    afterDatasetsDraw

    OptionalafterDatasetsDraw(chart: Chart<bar | line | scatter | bubble | pie | doughnut | polarArea | radar, (number | | BubbleDataPoint)[], unknown>, args: Record<string, never>, options: O, cancelable: false): void

    desc Called after the chart datasets have been drawn. Note that this hook will not be called if the datasets drawing has been previously cancelled.

    Parameters:

    NameTypeDescription
    chartChart<bar | line | scatter | bubble | pie | doughnut | polarArea | radar, (number | | BubbleDataPoint)[], unknown>The chart instance.
    argsRecord<string, never>The call arguments.
    optionsOThe plugin options.
    cancelablefalse-

    Returns: void

    Defined in:


    afterDatasetsUpdate

    OptionalafterDatasetsUpdate(chart: <bar | line | scatter | bubble | pie | doughnut | polarArea | radar, (number | ScatterDataPoint | )[], unknown>, args: { cancelable: true ; mode: resize | reset | none | hide | show | normal | active }, options: O): void

    desc Called after the chart datasets have been updated. Note that this hook will not be called if the datasets update has been previously cancelled.

    since version 2.1.5

    Parameters:

    NameTypeDescription
    chart<bar | line | scatter | bubble | pie | doughnut | polarArea | radar, (number | ScatterDataPoint | )[], unknown>The chart instance.
    argsobjectThe call arguments.
    args.cancelabletrue-
    args.moderesize | reset | none | hide | show | normal | activeThe update mode.
    optionsOThe plugin options.

    Returns: void

    Defined in: index.esm.d.ts:841 (opens new window)


    afterDraw

    OptionalafterDraw(chart: Chart<bar | line | scatter | bubble | pie | doughnut | polarArea | radar, (number | | BubbleDataPoint)[], unknown>, args: Record<string, never>, options: O): void

    desc Called after the chart has been drawn. Note that this hook will not be called if the drawing has been previously cancelled.

    Parameters:

    NameTypeDescription
    chartChart<bar | line | scatter | bubble | pie | doughnut | polarArea | radar, (number | | BubbleDataPoint)[], unknown>The chart instance.
    argsRecord<string, never>The call arguments.
    optionsOThe plugin options.

    Returns: void

    Defined in:


    afterEvent

    OptionalafterEvent(chart: <bar | line | scatter | bubble | pie | doughnut | polarArea | radar, (number | ScatterDataPoint | )[], unknown>, args: { cancelable: false ; changed?: boolean ; event: ChartEvent ; replay: boolean }, options: O): void

    desc Called after the event has been consumed. Note that this hook will not be called if the event has been previously discarded.

    Parameters:

    NameTypeDescription
    chartChart<bar | line | scatter | bubble | pie | doughnut | polarArea | radar, (number | | BubbleDataPoint)[], unknown>The chart instance.
    argsobjectThe call arguments.
    args.cancelablefalse-
    args.changed?boolean-
    args.eventThe event object.
    args.replaybooleanTrue if this event is replayed from Chart.update
    optionsOThe plugin options.

    Returns: void

    Defined in: index.esm.d.ts:1008 (opens new window)


    afterInit

    OptionalafterInit(chart: Chart<bar | line | scatter | bubble | pie | doughnut | polarArea | radar, (number | | BubbleDataPoint)[], unknown>, args: Record<string, never>, options: O): void

    desc Called after chart has been initialized and before the first update.

    Parameters:

    NameTypeDescription
    chartChart<bar | line | scatter | bubble | pie | doughnut | polarArea | radar, (number | | BubbleDataPoint)[], unknown>The chart instance.
    argsRecord<string, never>The call arguments.
    optionsOThe plugin options.

    Returns: void

    Defined in:


    afterLayout

    OptionalafterLayout(chart: <bar | line | scatter | bubble | pie | doughnut | polarArea | radar, (number | ScatterDataPoint | )[], unknown>, args: Record<string, never>, options: O): void

    desc Called after the chart has been laid out. Note that this hook will not be called if the layout update has been previously cancelled.

    Parameters:

    NameTypeDescription
    chart<bar | line | scatter | bubble | pie | doughnut | polarArea | radar, (number | ScatterDataPoint | )[], unknown>The chart instance.
    argsRecord<string, never>The call arguments.
    optionsOThe plugin options.

    Returns: void

    Defined in: index.esm.d.ts:913 (opens new window)


    OptionalafterRender(chart: <bar | line | scatter | bubble | pie | doughnut | polarArea | radar, (number | ScatterDataPoint | )[], unknown>, args: Record<string, never>, options: O): void

    desc Called after the chart has been fully rendered (and animation completed). Note that this hook will not be called if the rendering has been previously cancelled.

    Parameters:

    Returns: void

    Defined in:


    afterTooltipDraw

    OptionalafterTooltipDraw(chart: <bar | line | scatter | bubble | pie | doughnut | polarArea | radar, (number | ScatterDataPoint | )[], unknown>, args: { : TooltipModel<TType> }, options: Record<string, unknown>): void

    desc Called after drawing the tooltip. Note that this hook will not be called if the tooltip drawing has been previously cancelled.

    Parameters:

    NameTypeDescription
    chartChart<bar | line | scatter | bubble | pie | doughnut | polarArea | radar, (number | | BubbleDataPoint)[], unknown>The chart instance.
    argsobjectThe call arguments.
    args.tooltip<TType>The tooltip.
    optionsRecord<string, unknown>The plugin options.

    Returns: void

    Defined in: index.esm.d.ts:2389 (opens new window)


    afterUpdate

    OptionalafterUpdate(chart: Chart<bar | line | scatter | bubble | pie | doughnut | polarArea | radar, (number | | BubbleDataPoint)[], unknown>, args: { mode: resize | reset | none | hide | show | normal | active }, options: O): void

    desc Called after chart has been updated and before rendering. Note that this hook will not be called if the chart update has been previously cancelled.

    Parameters:

    NameTypeDescription
    chartChart<bar | line | scatter | bubble | pie | doughnut | polarArea | radar, (number | | BubbleDataPoint)[], unknown>The chart instance.
    argsobjectThe call arguments.
    args.moderesize | reset | none | hide | show | normal | activeThe update mode
    optionsOThe plugin options.

    Returns: void

    Defined in:


    beforeBuildTicks

    OptionalbeforeBuildTicks(chart: <bar | line | scatter | bubble | pie | doughnut | polarArea | radar, (number | ScatterDataPoint | )[], unknown>, args: { scale: Scale<> }, options: O): void

    desc Called before scale bulds its ticks. This hook is called separately for each scale in the chart.

    Parameters:

    NameTypeDescription
    chart<bar | line | scatter | bubble | pie | doughnut | polarArea | radar, (number | ScatterDataPoint | )[], unknown>The chart instance.
    argsobjectThe call arguments.
    args.scaleScale<>The scale.
    optionsOThe plugin options.

    Returns: void

    Defined in: index.esm.d.ts:897 (opens new window)


    beforeDataLimits

    OptionalbeforeDataLimits(chart: Chart<bar | line | scatter | bubble | pie | doughnut | polarArea | radar, (number | | BubbleDataPoint)[], unknown>, args: { scale: <CoreScaleOptions> }, options: O): void

    desc Called before scale data limits are calculated. This hook is called separately for each scale in the chart.

    Parameters:

    NameTypeDescription
    chartChart<bar | line | scatter | bubble | pie | doughnut | polarArea | radar, (number | | BubbleDataPoint)[], unknown>The chart instance.
    argsobjectThe call arguments.
    args.scale<CoreScaleOptions>The scale.
    optionsOThe plugin options.

    Returns: void

    Defined in:


    beforeDatasetDraw

    OptionalbeforeDatasetDraw(chart: <bar | line | scatter | bubble | pie | doughnut | polarArea | radar, (number | ScatterDataPoint | )[], unknown>, args: { index: number ; meta: ChartMeta<<{}, {}>, Element<{}, {}>> }, options: O): boolean | void

    desc Called before drawing the chart dataset at the given args.index (datasets are drawn in the reverse order). If any plugin returns false, the datasets drawing is cancelled until another render is triggered.

    Parameters:

    NameTypeDescription
    chartChart<bar | line | scatter | bubble | pie | doughnut | polarArea | radar, (number | | BubbleDataPoint)[], unknown>The chart instance.
    argsobjectThe call arguments.
    args.indexnumberThe dataset index.
    args.meta<Element<{}, {}>, <{}, {}>>The dataset metadata.
    optionsOThe plugin options.

    Returns: boolean | void

    false to cancel the chart datasets drawing.

    Defined in: index.esm.d.ts:976 (opens new window)


    beforeDatasetUpdate

    OptionalbeforeDatasetUpdate(chart: Chart<bar | line | scatter | bubble | pie | doughnut | polarArea | radar, (number | | BubbleDataPoint)[], unknown>, args: { cancelable: true ; index: number ; meta: <Element<{}, {}>, <{}, {}>> ; mode: resize | reset | none | hide | show | normal | active }, options: O): boolean | void

    desc Called before updating the chart dataset at the given args.index. If any plugin returns false, the datasets update is cancelled until another update is triggered.

    Parameters:

    NameTypeDescription
    chart<bar | line | scatter | bubble | pie | doughnut | polarArea | radar, (number | ScatterDataPoint | )[], unknown>The chart instance.
    argsobjectThe call arguments.
    args.cancelabletrue-
    args.indexnumberThe dataset index.
    args.metaChartMeta<<{}, {}>, Element<{}, {}>>The dataset metadata.
    args.moderesize | reset | none | hide | show | normal | activeThe update mode.
    optionsOThe plugin options.

    Returns: boolean | void

    false to cancel the chart datasets drawing.

    Defined in:


    beforeDatasetsDraw

    OptionalbeforeDatasetsDraw(chart: <bar | line | scatter | bubble | pie | doughnut | polarArea | radar, (number | ScatterDataPoint | )[], unknown>, args: { cancelable: true }, options: O): boolean | void

    desc Called before drawing the chart datasets. If any plugin returns false, the datasets drawing is cancelled until another render is triggered.

    Parameters:

    NameTypeDescription
    chart<bar | line | scatter | bubble | pie | doughnut | polarArea | radar, (number | ScatterDataPoint | )[], unknown>The chart instance.
    argsobjectThe call arguments.
    args.cancelabletrue-
    optionsOThe plugin options.

    Returns: boolean | void

    false to cancel the chart datasets drawing.

    Defined in: index.esm.d.ts:956 (opens new window)


    beforeDatasetsUpdate

    OptionalbeforeDatasetsUpdate(chart: Chart<bar | line | scatter | bubble | pie | doughnut | polarArea | radar, (number | | BubbleDataPoint)[], unknown>, args: { mode: resize | reset | none | hide | show | normal | active }, options: O): boolean | void

    desc Called before updating the chart datasets. If any plugin returns false, the datasets update is cancelled until another update is triggered.

    since version 2.1.5

    Parameters:

    NameTypeDescription
    chartChart<bar | line | scatter | bubble | pie | doughnut | polarArea | radar, (number | | BubbleDataPoint)[], unknown>The chart instance.
    argsobjectThe call arguments.
    args.moderesize | reset | none | hide | show | normal | activeThe update mode.
    optionsOThe plugin options.

    Returns: boolean | void

    false to cancel the datasets update.

    Defined in:


    beforeDraw

    OptionalbeforeDraw(chart: <bar | line | scatter | bubble | pie | doughnut | polarArea | radar, (number | ScatterDataPoint | )[], unknown>, args: { cancelable: true }, options: O): boolean | void

    desc Called before drawing chart at every animation frame. If any plugin returns false, the frame drawing is cancelled untilanother render is triggered.

    Parameters:

    NameTypeDescription
    chart<bar | line | scatter | bubble | pie | doughnut | polarArea | radar, (number | ScatterDataPoint | )[], unknown>The chart instance.
    argsobjectThe call arguments.
    args.cancelabletrue-
    optionsOThe plugin options.

    Returns: boolean | void

    false to cancel the chart drawing.

    Defined in: index.esm.d.ts:939 (opens new window)


    beforeElementsUpdate

    OptionalbeforeElementsUpdate(chart: Chart<bar | line | scatter | bubble | pie | doughnut | polarArea | radar, (number | | BubbleDataPoint)[], unknown>, args: Record<string, never>, options: O): void

    desc Called during the update process, before any chart elements have been created. This can be used for data decimation by changing the data array inside a dataset.

    Parameters:

    NameTypeDescription
    chartChart<bar | line | scatter | bubble | pie | doughnut | polarArea | radar, (number | | BubbleDataPoint)[], unknown>The chart instance.
    argsRecord<string, never>The call arguments.
    optionsOThe plugin options.

    Returns: void

    Defined in:


    OptionalbeforeEvent(chart: Chart<bar | line | scatter | bubble | pie | doughnut | polarArea | radar, (number | | BubbleDataPoint)[], unknown>, args: { cancelable: true ; event: ; replay: boolean }, options: O): boolean | void

    desc Called before processing the specified event. If any plugin returns false, the event will be discarded.

    Parameters:

    Returns: boolean | void

    Defined in:


    beforeInit

    OptionalbeforeInit(chart: <bar | line | scatter | bubble | pie | doughnut | polarArea | radar, (number | ScatterDataPoint | )[], unknown>, args: Record<string, never>, options: O): void

    desc Called before initializing chart.

    Parameters:

    NameTypeDescription
    chart<bar | line | scatter | bubble | pie | doughnut | polarArea | radar, (number | ScatterDataPoint | )[], unknown>The chart instance.
    argsRecord<string, never>The call arguments.
    optionsOThe plugin options.

    Returns: void

    Defined in: index.esm.d.ts:778Plugin - 图24 (opens new window)


    beforeLayout

    desc Called before laying out chart. If any plugin returns false, the layout update is cancelled until another update is triggered.

    Parameters:

    NameTypeDescription
    chart<bar | line | scatter | bubble | pie | doughnut | polarArea | radar, (number | ScatterDataPoint | )[], unknown>The chart instance.
    argsobjectThe call arguments.
    args.cancelabletrue-
    optionsOThe plugin options.

    Returns: boolean | void

    false to cancel the chart layout.

    Defined in: index.esm.d.ts:873 (opens new window)


    beforeRender

    OptionalbeforeRender(chart: Chart<bar | line | scatter | bubble | pie | doughnut | polarArea | radar, (number | | BubbleDataPoint)[], unknown>, args: { cancelable: true }, options: O): boolean | void

    desc Called before rendering chart. If any plugin returns false, the rendering is cancelled until another render is triggered.

    Parameters:

    NameTypeDescription
    chartChart<bar | line | scatter | bubble | pie | doughnut | polarArea | radar, (number | | BubbleDataPoint)[], unknown>The chart instance.
    argsobjectThe call arguments.
    args.cancelabletrue-
    optionsOThe plugin options.

    Returns: boolean | void

    false to cancel the chart rendering.

    Defined in:


    beforeTooltipDraw

    OptionalbeforeTooltipDraw(chart: <bar | line | scatter | bubble | pie | doughnut | polarArea | radar, (number | ScatterDataPoint | )[], unknown>, args: { tooltip: TooltipModel<TType> }, options: Record<string, unknown>): boolean | void

    desc Called before drawing the tooltip. If any plugin returns false, the tooltip drawing is cancelled until another render is triggered.

    Parameters:

    NameTypeDescription
    chartChart<bar | line | scatter | bubble | pie | doughnut | polarArea | radar, (number | | BubbleDataPoint)[], unknown>The chart instance.
    argsobjectThe call arguments.
    args.tooltip<TType>The tooltip.
    optionsRecord<string, unknown>The plugin options.

    Returns: boolean | void

    false to cancel the chart tooltip drawing.

    Inherited from: ExtendedPlugin

    Defined in:


    beforeUpdate

    OptionalbeforeUpdate(chart: <bar | line | scatter | bubble | pie | doughnut | polarArea | radar, (number | ScatterDataPoint | )[], unknown>, args: { cancelable: true ; mode: resize | reset | none | hide | show | normal | active }, options: O): boolean | void

    desc Called before updating chart. If any plugin returns false, the update is cancelled (and thus subsequent render(s)) until another update is triggered.

    Parameters:

    NameTypeDescription
    chart<bar | line | scatter | bubble | pie | doughnut | polarArea | radar, (number | ScatterDataPoint | )[], unknown>The chart instance.
    argsobjectThe call arguments.
    args.cancelabletrue-
    args.moderesize | reset | none | hide | show | normal | activeThe update mode
    optionsOThe plugin options.

    Returns: boolean | void

    false to cancel the chart update.

    Defined in: index.esm.d.ts:795Plugin - 图28 (opens new window)


    destroy

    Optionaldestroy(chart: Chart<bar | line | scatter | bubble | pie | doughnut | polarArea | radar, (number | | BubbleDataPoint)[], unknown>, args: Record<string, never>, options: O): void

    Called after the chart has been destroyed.

    Parameters:

    NameTypeDescription
    chartChart<bar | line | scatter | bubble | pie | doughnut | polarArea | radar, (number | | BubbleDataPoint)[], unknown>The chart instance.
    argsRecord<string, never>The call arguments.
    optionsOThe plugin options.

    Returns: void

    Defined in:


    install

    Optionalinstall(chart: <bar | line | scatter | bubble | pie | doughnut | polarArea | radar, (number | ScatterDataPoint | )[], unknown>, args: Record<string, never>, options: O): void

    desc Called when plugin is installed for this chart instance. This hook is also invoked for disabled plugins (options === false).

    since 3.0.0

    Parameters:

    NameTypeDescription
    chart<bar | line | scatter | bubble | pie | doughnut | polarArea | radar, (number | ScatterDataPoint | )[], unknown>The chart instance.
    argsRecord<string, never>The call arguments.
    optionsOThe plugin options.

    Returns: void

    Defined in: index.esm.d.ts:755Plugin - 图30 (opens new window)


    reset

    Optionalreset(chart: Chart<bar | line | scatter | bubble | pie | doughnut | polarArea | radar, (number | | BubbleDataPoint)[], unknown>, args: Record<string, never>, options: O): void

    desc Called during chart reset

    since version 3.0.0

    Parameters:

    NameTypeDescription
    chartChart<bar | line | scatter | bubble | pie | doughnut | polarArea | radar, (number | | BubbleDataPoint)[], unknown>The chart instance.
    argsRecord<string, never>The call arguments.
    optionsOThe plugin options.

    Returns: void

    Defined in:


    resize

    Optionalresize(chart: <bar | line | scatter | bubble | pie | doughnut | polarArea | radar, (number | ScatterDataPoint | )[], unknown>, args: { size: { height: number ; width: number } }, options: O): void

    desc Called after the chart as been resized.

    Parameters:

    NameTypeDescription
    chart<bar | line | scatter | bubble | pie | doughnut | polarArea | radar, (number | ScatterDataPoint | )[], unknown>The chart instance.
    argsobjectThe call arguments.
    args.sizeobjectThe new canvas display size (eq. canvas.style width & height).
    args.size.heightnumber-
    args.size.widthnumber-
    optionsOThe plugin options.

    Returns: void

    Defined in: index.esm.d.ts:1016Plugin - 图32 (opens new window)


    start

    Optionalstart(chart: Chart<bar | line | scatter | bubble | pie | doughnut | polarArea | radar, (number | | BubbleDataPoint)[], unknown>, args: Record<string, never>, options: O): void

    desc Called when a plugin is starting. This happens when chart is created or plugin is enabled.

    since 3.0.0

    Parameters:

    NameTypeDescription
    chartChart<bar | line | scatter | bubble | pie | doughnut | polarArea | radar, (number | | BubbleDataPoint)[], unknown>The chart instance.
    argsRecord<string, never>The call arguments.
    optionsOThe plugin options.

    Returns: void

    Defined in:


    Optionalstop(chart: Chart<bar | line | scatter | bubble | pie | doughnut | polarArea | radar, (number | | BubbleDataPoint)[], unknown>, args: Record<string, never>, options: O): void

    desc Called when a plugin stopping. This happens when chart is destroyed or plugin is disabled.

    since 3.0.0

    Parameters:

    Returns: void

    Defined in: index.esm.d.ts:771Plugin - 图34 (opens new window)


    uninstall

    Optionaluninstall(chart: Chart<bar | line | scatter | bubble | pie | doughnut | polarArea | radar, (number | | BubbleDataPoint)[], unknown>, args: Record<string, never>, options: O): void

    Called after chart is destroyed on all plugins that were installed for that chart. This hook is also invoked for disabled plugins (options === false).

    since 3.0.0

    Parameters:

    NameTypeDescription
    chartChart<bar | line | scatter | bubble | pie | doughnut | polarArea | radar, (number | | BubbleDataPoint)[], unknown>The chart instance.
    Record<string, never>The call arguments.
    optionsOThe plugin options.

    Defined in: