Interface: CoreChartOptions<TType>

Type parameters

NameType
TTypeextends ChartType

Hierarchy

Properties

animation

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

Inherited from

AnimationOptions.animation

Defined in

index.esm.d.ts:1640CoreChartOptions - 图1 (opens new window)


animations

animations: AnimationsSpec<TType>

Inherited from

AnimationOptions.animations

Defined in

index.esm.d.ts:1650CoreChartOptions - 图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

Defined in

index.esm.d.ts:1505CoreChartOptions - 图3 (opens new window)


backgroundColor

backgroundColor: Scriptable<Color, ScriptableContext<TType>>

base background color

see Defaults.backgroundColor

Defined in

index.esm.d.ts:1474CoreChartOptions - 图4 (opens new window)


borderColor

borderColor: Scriptable<Color, ScriptableContext<TType>>

base border color

see Defaults.borderColor

Defined in

index.esm.d.ts:1479CoreChartOptions - 图5 (opens new window)


clip

clip: number | false | ChartArea

How to clip relative to chartArea. Positive value allows overflow, negative value clips that many pixels inside chartArea. 0 = clip at chartArea. Clipping can also be configured per side: clip: {left: 5, top: false, right: -2, bottom: 0}

Defined in

index.esm.d.ts:1463CoreChartOptions - 图6 (opens new window)


color

color: Scriptable<Color, ScriptableContext<TType>>

base color

see Defaults.color

Defined in

index.esm.d.ts:1469CoreChartOptions - 图7 (opens new window)


datasets

datasets: Object

Type declaration

NameType
barBarControllerDatasetOptions
bubbleBubbleControllerDatasetOptions
doughnutDoughnutControllerDatasetOptions
lineLineControllerDatasetOptions & FillerControllerDatasetOptions
pieDoughnutControllerDatasetOptions
polarAreaPolarAreaControllerDatasetOptions
radarRadarControllerDatasetOptions & FillerControllerDatasetOptions
scatterLineControllerDatasetOptions

Defined in

index.esm.d.ts:1450CoreChartOptions - 图8 (opens new window)


devicePixelRatio

devicePixelRatio: number

Override the window’s default devicePixelRatio.

default window.devicePixelRatio

Defined in

index.esm.d.ts:1522CoreChartOptions - 图9 (opens new window)


events

events: keyof HTMLElementEventMap[]

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:1532CoreChartOptions - 图10 (opens new window)


font

font: Partial<FontSpec>

base font

see Defaults.font

Defined in

index.esm.d.ts:1484CoreChartOptions - 图11 (opens new window)


hover

hover: CoreInteractionOptions

Defined in

index.esm.d.ts:1526CoreChartOptions - 图12 (opens new window)


indexAxis

indexAxis: "x" | "y"

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

default ‘x’

Defined in

index.esm.d.ts:1458CoreChartOptions - 图13 (opens new window)


interaction

interaction: CoreInteractionOptions

Defined in

index.esm.d.ts:1524CoreChartOptions - 图14 (opens new window)


layout

layout: Partial<{ autoPadding: boolean ; padding: Scriptable<number | Partial<ChartArea>, ScriptableContext<TType>> }>

Defined in

index.esm.d.ts:1544CoreChartOptions - 图15 (opens new window)


locale

locale: string

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

default user’s browser setting

Defined in

index.esm.d.ts:1511CoreChartOptions - 图16 (opens new window)


maintainAspectRatio

maintainAspectRatio: boolean

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

default true

Defined in

index.esm.d.ts:1494CoreChartOptions - 图17 (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

ParsingOptions.normalized

Defined in

index.esm.d.ts:58CoreChartOptions - 图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

ParsingOptions.parsing

Defined in

index.esm.d.ts:49CoreChartOptions - 图19 (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

Defined in

index.esm.d.ts:1499CoreChartOptions - 图20 (opens new window)


responsive

responsive: boolean

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

default true

Defined in

index.esm.d.ts:1489CoreChartOptions - 图21 (opens new window)


transitions

transitions: TransitionsSpec<TType>

Inherited from

AnimationOptions.transitions

Defined in

index.esm.d.ts:1651CoreChartOptions - 图22 (opens new window)

Methods

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
eventChartEvent
elementsActiveElement[]
chartChart<keyof ChartTypeRegistry, (number | ScatterDataPoint | BubbleDataPoint)[], unknown>

Returns

void

Defined in

index.esm.d.ts:1542CoreChartOptions - 图23 (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
eventChartEvent
elementsActiveElement[]
chartChart<keyof ChartTypeRegistry, (number | ScatterDataPoint | BubbleDataPoint)[], unknown>

Returns

void

Defined in

index.esm.d.ts:1537CoreChartOptions - 图24 (opens new window)


onResize

onResize(chart, size): void

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

Parameters

NameType
chartChart<keyof ChartTypeRegistry, (number | ScatterDataPoint | BubbleDataPoint)[], unknown>
sizeObject
size.heightnumber
size.widthnumber

Returns

void

Defined in

index.esm.d.ts:1516CoreChartOptions - 图25 (opens new window)