Interface: Defaults

    animation: false | <bar | line | scatter | bubble | pie | doughnut | polarArea | radar> & { : (event: AnimationEvent) => void ; onProgress?: (event: ) => void }

    Inherited from: CoreChartOptions.

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


    animations

    animations: AnimationsSpec<bar | line | scatter | bubble | pie | doughnut | polarArea | radar>

    Inherited from: .animations

    Defined in:


    aspectRatio

    aspectRatio: number

    Canvas aspect ratio (i.e. width / height, a value of 1 representing a square canvas). Note that this option is ignored if the height is explicitly defined either as attribute or via the style.

    default 2

    Inherited from: .aspectRatio

    Defined in:


    backgroundColor

    backgroundColor:

    base background color

    see Defaults.backgroundColor

    Inherited from: CoreChartOptions.

    Defined in: index.esm.d.ts:1367Defaults - 图4 (opens new window)


    borderColor

    borderColor: Color

    base border color

    see Defaults.borderColor

    Inherited from: .borderColor

    Defined in:


    color

    color:

    base color

    see Defaults.color

    Inherited from: CoreChartOptions.

    Defined in: index.esm.d.ts:1362Defaults - 图6 (opens new window)


    datasets

    datasets: object

    Type declaration:

    Inherited from: .datasets

    Defined in:


    devicePixelRatio

    devicePixelRatio: number

    Override the window’s default devicePixelRatio.

    default window.devicePixelRatio

    Inherited from: .devicePixelRatio

    Defined in:


    elements

    elements: Partial<>

    Inherited from: ElementChartOptions.

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


    events

    events: (mousemove | mouseout | click | touchstart | touchmove)[]

    The events option defines the browser events that the chart should listen to for tooltips and hovering.

    default [‘mousemove’, ‘mouseout’, ‘click’, ‘touchstart’, ‘touchmove’]

    Defined in: index.esm.d.ts:1420Defaults - 图10 (opens new window)


    font:

    base font

    see Defaults.font

    Inherited from: CoreChartOptions.

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


    hover

    hover: CoreInteractionOptions

    Inherited from: .hover

    Defined in:


    indexAxis

    indexAxis: x | y

    The base axis of the chart. ‘x’ for vertical charts and ‘y’ for horizontal charts.

    default ‘x’

    Inherited from: .indexAxis

    Defined in:


    interaction

    interaction:

    Inherited from: CoreChartOptions.

    Defined in: index.esm.d.ts:1412Defaults - 图14 (opens new window)


    layout

    layout: object

    Type declaration:

    NameType
    padding<number | ChartArea, <bar | line | scatter | bubble | pie | doughnut | polarArea | radar>>

    Inherited from: CoreChartOptions.

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


    locale

    locale: string

    Locale used for number formatting (using Intl.NumberFormat).

    default user’s browser setting

    Inherited from: CoreChartOptions.

    Defined in: index.esm.d.ts:1399Defaults - 图16 (opens new window)


    maintainAspectRatio

    maintainAspectRatio: boolean

    Maintain the original canvas aspect ratio (width / height) when resizing.

    default true

    Inherited from: CoreChartOptions.

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


    normalized

    normalized: boolean

    Chart.js is fastest if you provide data with indices that are unique, sorted, and consistent across datasets and provide the normalized: true option to let Chart.js know that you have done so.

    Inherited from: CoreChartOptions.

    Defined in: index.esm.d.ts:46Defaults - 图18 (opens new window)


    parsing

    parsing: false | { [key: string]: string; }

    How to parse the dataset. The parsing can be disabled by specifying parsing: false at chart options or dataset. If parsing is disabled, data must be sorted and in the formats the associated chart type and scales use internally.

    Inherited from: CoreChartOptions.

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


    plugins

    plugins: PluginOptionsByType<bar | line | scatter | bubble | pie | doughnut | polarArea | radar>

    Inherited from: .plugins

    Defined in:


    responsive: boolean

    Resizes the chart canvas when its container does (important note…).

    Inherited from: CoreChartOptions.

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


    scale

    scale: ScaleOptionsByType<linear | logarithmic | category | time | timeseries | radialLinear>

    Defined in:


    scales

    scales: object

    Type declaration:

    NameType
    linear
    logarithmic
    radialLinear
    time
    timeseries

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


    transitions

    transitions: TransitionsSpec<bar | line | scatter | bubble | pie | doughnut | polarArea | radar>

    Inherited from: .transitions

    Defined in:

    describe

    describe(scope: string, values: Record<string, unknown>): Record<string, unknown>

    Parameters:

    NameType
    scopestring
    valuesRecord<string, unknown>

    Returns: Record<string, unknown>

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


    get

    get(scope: string): Record<string, unknown>

    Parameters:

    Returns: Record<string, unknown>

    Defined in:


    onClick

    onClick(event: , elements: ActiveElement[], chart: <bar | line | scatter | bubble | pie | doughnut | polarArea | radar, (number | ScatterDataPoint | )[], unknown>): void

    Called if the event is of type ‘mouseup’ or ‘click’. Passed the event, an array of active elements, and the chart.

    Parameters:

    NameType
    event
    elementsActiveElement[]
    chart<bar | line | scatter | bubble | pie | doughnut | polarArea | radar, (number | ScatterDataPoint | )[], unknown>

    Returns: void

    Inherited from: CoreChartOptions

    Defined in:


    onHover

    onHover(event: , elements: ActiveElement[], chart: <bar | line | scatter | bubble | pie | doughnut | polarArea | radar, (number | ScatterDataPoint | )[], unknown>): void

    Called when any of the events fire. Passed the event, an array of active elements (bars, points, etc), and the chart.

    Parameters:

    NameType
    event
    elementsActiveElement[]
    chart<bar | line | scatter | bubble | pie | doughnut | polarArea | radar, (number | ScatterDataPoint | )[], unknown>

    Returns: void

    Inherited from: CoreChartOptions

    Defined in:


    onResize

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

    Called when a resize occurs. Gets passed two arguments: the chart instance and the new size.

    Parameters:

    NameType
    chart<bar | line | scatter | bubble | pie | doughnut | polarArea | radar, (number | ScatterDataPoint | )[], unknown>
    sizeobject
    size.heightnumber
    size.widthnumber

    Returns: void

    Inherited from: CoreChartOptions

    Defined in:


    override

    override(scope: string, values: Record<string, unknown>): Record<string, unknown>

    Parameters:

    Returns: Record<string, unknown>

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


    route(scope: string, name: string, targetScope: string, targetName: string): void

    Routes the named defaults to fallback to another scope/name. This routing is useful when those target values, like defaults.color, are changed runtime. If the values would be copied, the runtime change would not take effect. By routing, the fallback is evaluated at each access, so its always up to date.

    Example:

    defaults.route(‘elements.arc’, ‘backgroundColor’, ‘’, ‘color’)

    Parameters:

    NameTypeDescription
    scopestringScope this route applies to.
    namestringProperty name that should be routed to different namespace when not defined here.
    targetScopestringThe namespace where those properties should be routed to. Empty string (‘’) is the root of defaults.
    targetNamestringThe target name in the target scope the property should be routed to.

    Returns: void

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


    set

    set(values: Record<string, unknown>): Record<string, unknown>

    Parameters:

    NameType
    valuesRecord<string, unknown>

    Returns: Record<string, unknown>

    Defined in:

    set(scope: string, values: Record<string, unknown>): Record<string, unknown>

    Parameters:

    NameType
    scopestring
    valuesRecord<string, unknown>

    Defined in: