Interface: Defaults

    animation: false | AnimationSpec<keyof > & { onComplete?: (event: AnimationEvent) => void ; onProgress?: (event: ) => void }

    Inherited from

    .animation

    Defined in

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


    animations

    animations: AnimationsSpec<keyof >

    Inherited from

    .animations

    Defined in

    index.esm.d.ts:1609Defaults - 图2 (opens new window)


    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

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


    backgroundColor

    backgroundColor: Scriptable<, ScriptableContext<keyof >>

    base background color

    see Defaults.backgroundColor

    Inherited from

    .backgroundColor

    Defined in

    index.esm.d.ts:1420Defaults - 图4 (opens new window)


    borderColor

    borderColor: Scriptable<, ScriptableContext<keyof >>

    base border color

    see Defaults.borderColor

    Inherited from

    .borderColor

    Defined in

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


    color

    color: Scriptable<, ScriptableContext<keyof >>

    base color

    see Defaults.color

    Inherited from

    .color

    Defined in

    index.esm.d.ts:1415Defaults - 图6 (opens new window)


    datasets

    datasets: Object

    Type declaration

    Inherited from

    CoreChartOptions.

    Defined in


    devicePixelRatio

    devicePixelRatio: number

    Override the window’s default devicePixelRatio.

    default window.devicePixelRatio

    Inherited from

    CoreChartOptions.

    Defined in


    elements

    elements: <keyof ChartTypeRegistry>

    Inherited from

    ElementChartOptions.elements

    Defined in


    events

    events: ("mousemove" | "mouseout" | "click" | "touchstart" | "touchmove" | "touchend" | "pointerenter" | "pointerdown" | "pointermove" | "pointerup" | "pointerleave" | "pointerout")[]

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

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

    Inherited from

    CoreChartOptions.

    Defined in


    font

    base font

    see Defaults.font

    Inherited from

    CoreChartOptions.

    Defined in


    hover: CoreInteractionOptions

    Inherited from

    CoreChartOptions.

    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

    CoreChartOptions.

    Defined in


    interaction

    interaction:

    Inherited from

    .interaction

    Defined in

    index.esm.d.ts:1470Defaults - 图14 (opens new window)


    layout

    layout: Partial<Object>

    Inherited from

    .layout

    Defined in

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


    locale

    locale: string

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

    default user’s browser setting

    Inherited from

    .locale

    Defined in

    index.esm.d.ts:1457Defaults - 图16 (opens new window)


    maintainAspectRatio

    maintainAspectRatio: boolean

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

    true

    Inherited from

    .maintainAspectRatio

    Defined in

    index.esm.d.ts:1440 (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

    .normalized

    Defined in

    index.esm.d.ts:55Defaults - 图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

    .parsing

    Defined in

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


    plugins

    plugins: PluginOptionsByType<keyof >

    Inherited from

    .plugins

    Defined in

    index.esm.d.ts:2754Defaults - 图20 (opens new window)


    resizeDelay

    resizeDelay: number

    Delay the resize update by give amount of milliseconds. This can ease the resize process by debouncing update of the elements.

    default 0

    Inherited from

    .resizeDelay

    Defined in

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


    responsive

    responsive: boolean

    default true

    Inherited from

    .responsive

    Defined in

    index.esm.d.ts:1435Defaults - 图22 (opens new window)


    scale: <keyof ScaleTypeRegistry>

    Defined in

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


    scales

    scales: Object

    Type declaration

    NameType
    category
    linear
    logarithmic
    radialLinear
    time
    timeseries

    Defined in

    index.esm.d.ts:649Defaults - 图24 (opens new window)


    transitions

    transitions: TransitionsSpec<keyof >

    Inherited from

    .transitions

    Defined in

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

    describe

    describe(scope, values): AnyObject

    Parameters

    NameType
    scopestring
    valuesAnyObject

    Returns

    AnyObject

    Defined in


    get

    get(scope): AnyObject

    Parameters

    Returns

    AnyObject

    Defined in

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


    onClick

    onClick(event, elements, chart): 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<keyof ChartTypeRegistry, (number | | BubbleDataPoint)[], unknown>

    Returns

    void

    Inherited from

    .onClick

    Defined in

    index.esm.d.ts:1501Defaults - 图28 (opens new window)


    onHover

    onHover(event, elements, chart): 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<keyof ChartTypeRegistry, (number | | BubbleDataPoint)[], unknown>

    Returns

    void

    Inherited from

    .onHover

    Defined in

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


    onResize

    onResize(, size): void

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

    Parameters

    Returns

    void

    Inherited from

    .onResize

    Defined in

    index.esm.d.ts:1462Defaults - 图30 (opens new window)


    override

    override(scope, values): AnyObject

    Parameters

    NameType
    scopestring
    valuesAnyObject

    Returns

    AnyObject

    Defined in


    route

    route(scope, name, targetScope, targetName): 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:677Defaults - 图32 (opens new window)


    set

    set(values): AnyObject

    Parameters

    Returns

    AnyObject

    Defined in

    set(scope, values): AnyObject

    Parameters

    NameType
    scopestring
    valuesAnyObject

    Returns

    AnyObject

    Defined in