Chart.js - v3.0.2

Table of contents

Enumerations

Classes

Interfaces

Type aliases

AnimationOptions

Ƭ AnimationOptions<TType>: object

Type parameters:

NameType
TTypeChartType

Type declaration:

NameType
animationfalse | AnimationSpec<TType> & { onComplete?: (this: Chart, event: AnimationEvent) => void ; onProgress?: (this: Chart, event: AnimationEvent) => void }
animationsAnimationsSpec<TType>
transitionsTransitionsSpec<TType>

Defined in: index.esm.d.ts:1526API - 图1 (opens new window)


AnimationSpec

Ƭ AnimationSpec<TType>: object

Type parameters:

NameType
TTypeChartType

Type declaration:

NameTypeDescription
delay?Scriptable<number, ScriptableContext<TType>>Delay before starting the animations. default 0
duration?Scriptable<number, ScriptableContext<TType>>The number of milliseconds an animation takes. default 1000
easing?Scriptable<EasingFunction, ScriptableContext<TType>>Easing function to use default ‘easeOutQuart’
loop?Scriptable<boolean, ScriptableContext<TType>>If set to true, the animations loop endlessly. default false

Defined in: index.esm.d.ts:1470API - 图2 (opens new window)


AnimationsSpec

Ƭ AnimationsSpec<TType>: object

Type parameters:

NameType
TTypeChartType

Type declaration:

Defined in: index.esm.d.ts:1495API - 图3 (opens new window)


BarController

Ƭ BarController: DatasetController

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


BubbleController

Ƭ BubbleController: DatasetController

Defined in: index.esm.d.ts:161API - 图5 (opens new window)


CategoryScale

Ƭ CategoryScale<O>: Scale<O>

Type parameters:

NameTypeDefault
OCategoryScaleOptionsCategoryScaleOptions

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


CategoryScaleOptions

Ƭ CategoryScaleOptions: CartesianScaleOptions & { labels: string[] | string[][] ; max: string | number ; min: string | number }

Defined in: index.esm.d.ts:2777API - 图7 (opens new window)


ChartComponentLike

Ƭ ChartComponentLike: ChartComponent | ChartComponent[] | { [key: string]: ChartComponent; }

Defined in: index.esm.d.ts:1028API - 图8 (opens new window)


ChartDataset

Ƭ ChartDataset<TType, TData>: DeepPartial<{ [key in ChartType]: object & ChartTypeRegistry[key][“datasetOptions”]}[TType]> & ChartDatasetProperties<TType, TData>

Type parameters:

NameTypeDefault
TTypeChartTypeChartType
TData-TType[]

Defined in: index.esm.d.ts:3268API - 图9 (opens new window)


ChartItem

Ƭ ChartItem: string | CanvasRenderingContext2D | OffscreenCanvasRenderingContext2D | HTMLCanvasElement | OffscreenCanvas | { canvas: HTMLCanvasElement | OffscreenCanvas } | ArrayLike<CanvasRenderingContext2D | HTMLCanvasElement | OffscreenCanvas>

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


ChartOptions

Ƭ ChartOptions<TType>: DeepPartial<CoreChartOptions<TType> & ElementChartOptions & PluginChartOptions<TType> & DatasetChartOptions<TType> & ScaleChartOptions<TType> & ChartTypeRegistry[TType][chartOptions]>

Type parameters:

NameTypeDefault
TTypeChartTypeChartType

Defined in: index.esm.d.ts:3250API - 图11 (opens new window)


ChartType

Ƭ ChartType: keyof ChartTypeRegistry

Defined in: index.esm.d.ts:3229API - 图12 (opens new window)


Color

Ƭ Color: string | CanvasGradient | CanvasPattern

Defined in: color.d.ts:1API - 图13 (opens new window)


DatasetChartOptions

Ƭ DatasetChartOptions<TType>: { [key in TType]: object}

Type parameters:

NameTypeDefault
TTypeChartTypeChartType

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


DecimationOptions

Ƭ DecimationOptions: LttbDecimationOptions | MinMaxDecimationOptions

Defined in: index.esm.d.ts:1943API - 图15 (opens new window)


DefaultDataPoint

Ƭ DefaultDataPoint<TType>: ChartTypeRegistry[TType][defaultDataPoint][]

Type parameters:

NameType
TTypeChartType

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


DoughnutDataPoint

Ƭ DoughnutDataPoint: number

Defined in: index.esm.d.ts:294API - 图17 (opens new window)


EasingFunction

Ƭ EasingFunction: linear | easeInQuad | easeOutQuad | easeInOutQuad | easeInCubic | easeOutCubic | easeInOutCubic | easeInQuart | easeOutQuart | easeInOutQuart | easeInQuint | easeOutQuint | easeInOutQuint | easeInSine | easeOutSine | easeInOutSine | easeInExpo | easeOutExpo | easeInOutExpo | easeInCirc | easeOutCirc | easeInOutCirc | easeInElastic | easeOutElastic | easeInOutElastic | easeInBack | easeOutBack | easeInOutBack | easeInBounce | easeOutBounce | easeInOutBounce

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


FillTarget

Ƭ FillTarget: number | string | { value: number } | start | end | origin | stack | boolean

Defined in: index.esm.d.ts:1950API - 图19 (opens new window)


InteractionMode

Ƭ InteractionMode: keyof InteractionModeMap

Defined in: index.esm.d.ts:695API - 图20 (opens new window)


InteractionModeFunction

Ƭ InteractionModeFunction: (chart: Chart, e: ChartEvent, options: InteractionOptions, useFinalPosition?: boolean) => InteractionItem[]

Type declaration:

▸ (chart: Chart, e: ChartEvent, options: InteractionOptions, useFinalPosition?: boolean): InteractionItem[]

Parameters:

NameType
chartChart
eChartEvent
optionsInteractionOptions
useFinalPosition?boolean

Returns: InteractionItem[]

Defined in: index.esm.d.ts:657API - 图21 (opens new window)


LayoutPosition

Ƭ LayoutPosition: left | top | right | bottom | center | chartArea | { [scaleId: string]: number; }

Defined in: layout.d.ts:3API - 图22 (opens new window)


LineController

Ƭ LineController: DatasetController

Defined in: index.esm.d.ts:205API - 图23 (opens new window)


LinearScale

Ƭ LinearScale<O>: Scale<O>

Type parameters:

NameTypeDefault
OLinearScaleOptionsLinearScaleOptions

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


LinearScaleOptions

Ƭ LinearScaleOptions: CartesianScaleOptions & { beginAtZero: boolean ; suggestedMax?: number ; suggestedMin?: number ; ticks: { count: number ; format: Intl.NumberFormatOptions ; maxTicksLimit: number ; precision: number ; stepSize: number } }

Defined in: index.esm.d.ts:2789API - 图25 (opens new window)


LogarithmicScale

Ƭ LogarithmicScale<O>: Scale<O>

Type parameters:

NameTypeDefault
OLogarithmicScaleOptionsLogarithmicScaleOptions

Defined in: index.esm.d.ts:2859API - 图26 (opens new window)


LogarithmicScaleOptions

Ƭ LogarithmicScaleOptions: CartesianScaleOptions & { suggestedMax?: number ; suggestedMin?: number ; ticks: { format: Intl.NumberFormatOptions } }

Defined in: index.esm.d.ts:2840API - 图27 (opens new window)


Overrides

Ƭ Overrides: { [key in ChartType]: CoreChartOptions<key> & ElementChartOptions & PluginChartOptions<key> & DatasetChartOptions<ChartType> & ScaleChartOptions<key> & ChartTypeRegistry[key][“chartOptions”]}

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


ParsedDataType

Ƭ ParsedDataType<TType>: ChartTypeRegistry[TType][parsedDataType]

Type parameters:

NameTypeDefault
TTypeChartTypeChartType

Defined in: index.esm.d.ts:3261API - 图29 (opens new window)


PieAnimationOptions

Ƭ PieAnimationOptions: DoughnutAnimationOptions

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


PieController

Ƭ PieController: DoughnutController

Defined in: index.esm.d.ts:317API - 图31 (opens new window)


PieControllerChartOptions

Ƭ PieControllerChartOptions: DoughnutControllerChartOptions

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


PieControllerDatasetOptions

Ƭ PieControllerDatasetOptions: DoughnutControllerDatasetOptions

Defined in: index.esm.d.ts:311API - 图33 (opens new window)


PieDataPoint

Ƭ PieDataPoint: DoughnutDataPoint

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


PointStyle

Ƭ PointStyle: circle | cross | crossRot | dash | line | rect | rectRounded | rectRot | star | triangle | HTMLImageElement | HTMLCanvasElement

Defined in: index.esm.d.ts:1706API - 图35 (opens new window)


PolarAreaAnimationOptions

Ƭ PolarAreaAnimationOptions: DoughnutAnimationOptions

Defined in: index.esm.d.ts:331API - 图36 (opens new window)


RadarController

Ƭ RadarController: DatasetController

Defined in: index.esm.d.ts:380API - 图37 (opens new window)


RadarControllerChartOptions

Ƭ RadarControllerChartOptions: LineControllerChartOptions

Defined in: index.esm.d.ts:378API - 图38 (opens new window)


RadialLinearScaleOptions

Ƭ RadialLinearScaleOptions: CoreScaleOptions & { angleLines: { borderDash: Scriptable<number[], ScriptableScaleContext> ; borderDashOffset: Scriptable<number, ScriptableScaleContext> ; color: Scriptable<Color, ScriptableScaleContext> ; display: boolean ; lineWidth: Scriptable<number, ScriptableScaleContext> } ; animate: boolean ; beginAtZero: boolean ; grid: GridLineOptions ; max: number ; min: number ; pointLabels: { backdropColor: Scriptable<Color, ScriptableScaleContext> ; backdropPadding: Scriptable<number | ChartArea, ScriptableScaleContext> ; callback: (label: string, index: number) => string ; color: Scriptable<Color, ScriptableScaleContext> ; display: boolean ; font: Scriptable<FontSpec, ScriptableScaleContext> } ; suggestedMax: number ; suggestedMin: number ; ticks: TickOptions & { backdropColor: Scriptable<Color, ScriptableScaleContext> ; backdropPadding: number | ChartArea ; count: number ; format: Intl.NumberFormatOptions ; maxTicksLimit: number ; precision: number ; showLabelBackdrop: Scriptable<boolean, ScriptableScaleContext> ; stepSize: number } }

Defined in: index.esm.d.ts:2956API - 图39 (opens new window)


ScaleChartOptions

Ƭ ScaleChartOptions<TType>: object

Type parameters:

NameTypeDefault
TTypeChartTypeChartType

Type declaration:

NameType
scalesobject

Defined in: index.esm.d.ts:3244API - 图40 (opens new window)


ScaleOptions

Ƭ ScaleOptions<TScale>: DeepPartial<ScaleOptionsByType<TScale>>

Type parameters:

NameTypeDefault
TScaleScaleTypeScaleType

Defined in: index.esm.d.ts:3236API - 图41 (opens new window)


ScaleOptionsByType

Ƭ ScaleOptionsByType<TScale>: { [key in ScaleType]: object & ScaleTypeRegistry[key][“options”]}[TScale]

Type parameters:

NameTypeDefault
TScaleScaleTypeScaleType

Defined in: index.esm.d.ts:3231API - 图42 (opens new window)


ScaleType

Ƭ ScaleType: keyof ScaleTypeRegistry

Defined in: index.esm.d.ts:3133API - 图43 (opens new window)


ScatterController

Ƭ ScatterController: LineController

Defined in: index.esm.d.ts:220API - 图44 (opens new window)


ScatterControllerChartOptions

Ƭ ScatterControllerChartOptions: LineControllerChartOptions

Defined in: index.esm.d.ts:218API - 图45 (opens new window)


ScatterControllerDatasetOptions

Ƭ ScatterControllerDatasetOptions: LineControllerDatasetOptions

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


Scriptable

Ƭ Scriptable<T, TContext>: T | (ctx: TContext) => T

Type parameters:

Name
T
TContext

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


ScriptableAndArray

Ƭ ScriptableAndArray<T, TContext>: readonly T[] | Scriptable<T, TContext>

Type parameters:

Name
T
TContext

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


ScriptableAndArrayOptions

Ƭ ScriptableAndArrayOptions<T, TContext>: { [P in keyof T]: ScriptableAndArray<T[P], TContext>}

Type parameters:

Name
T
TContext

Defined in: index.esm.d.ts:31API - 图49 (opens new window)


ScriptableOptions

Ƭ ScriptableOptions<T, TContext>: { [P in keyof T]: Scriptable<T[P], TContext>}

Type parameters:

Name
T
TContext

Defined in: index.esm.d.ts:29API - 图50 (opens new window)


TextAlign

Ƭ TextAlign: left | center | right

Defined in: index.esm.d.ts:1568API - 图51 (opens new window)


TimeScaleOptions

Ƭ TimeScaleOptions: CartesianScaleOptions & { adapters: { date: unknown } ; bounds: ticks | data ; ticks: { source: labels | auto | data } ; time: { displayFormats: { [key: string]: string; } ; isoWeekday: false | number ; minUnit: TimeUnit ; parser: string | (v: unknown) => number ; round: false | TimeUnit ; stepSize: number ; tooltipFormat: string ; unit: false | TimeUnit } }

Defined in: index.esm.d.ts:2865API - 图52 (opens new window)


TimeSeriesScale

Ƭ TimeSeriesScale<O>: TimeScale<O>

Type parameters:

NameTypeDefault
OTimeScaleOptionsTimeScaleOptions

Defined in: index.esm.d.ts:2950API - 图53 (opens new window)


TimeUnit

Ƭ TimeUnit: millisecond | second | minute | hour | day | week | month | quarter | year

Defined in: adapters.d.ts:1API - 图54 (opens new window)


TooltipXAlignment

Ƭ TooltipXAlignment: left | center | right

Defined in: index.esm.d.ts:2211API - 图55 (opens new window)


TooltipYAlignment

Ƭ TooltipYAlignment: top | center | bottom

Defined in: index.esm.d.ts:2212API - 图56 (opens new window)


TransitionSpec

Ƭ TransitionSpec<TType>: object

Type parameters:

NameType
TTypeChartType

Type declaration:

NameType
animationAnimationSpec<TType>
animationsAnimationsSpec<TType>

Defined in: index.esm.d.ts:1517API - 图57 (opens new window)


TransitionsSpec

Ƭ TransitionsSpec<TType>: object

Type parameters:

NameType
TTypeChartType

Type declaration:

Defined in: index.esm.d.ts:1522API - 图58 (opens new window)


UpdateMode

Ƭ UpdateMode: keyof typeof UpdateModeEnum

Defined in: index.esm.d.ts:519API - 图59 (opens new window)

Variables

ArcElement

ArcElement: ChartComponent & { prototype: ArcElement<ArcProps, ArcOptions> }

Defined in: index.esm.d.ts:1626API - 图60 (opens new window)


BarController

BarController: ChartComponent & { prototype: BarController }

Defined in: index.esm.d.ts:134API - 图61 (opens new window)


BarElement

BarElement: ChartComponent & { prototype: BarElement<BarProps, BarOptions> }

Defined in: index.esm.d.ts:1856API - 图62 (opens new window)


BubbleController

BubbleController: ChartComponent & { prototype: BubbleController }

Defined in: index.esm.d.ts:162API - 图63 (opens new window)


CategoryScale

CategoryScale: ChartComponent & { prototype: CategoryScale<CategoryScaleOptions> }

Defined in: index.esm.d.ts:2784API - 图64 (opens new window)


DoughnutController

DoughnutController: ChartComponent & { prototype: DoughnutController }

Defined in: index.esm.d.ts:306API - 图65 (opens new window)


Element

Element: object

Type declaration:

NameType
prototypeElement<{}, {}>

Defined in: element.d.ts:27API - 图66 (opens new window)


Filler

Const Filler: Plugin

Defined in: index.esm.d.ts:1945API - 图67 (opens new window)


Interaction

Const Interaction: object

Type declaration:

NameType
modesInteractionModeMap

Defined in: index.esm.d.ts:697API - 图68 (opens new window)


Legend

Const Legend: Plugin

Defined in: index.esm.d.ts:1974API - 图69 (opens new window)


LineController

LineController: ChartComponent & { prototype: LineController }

Defined in: index.esm.d.ts:206API - 图70 (opens new window)


LineElement

LineElement: ChartComponent & { prototype: LineElement<LineProps, LineOptions> }

Defined in: index.esm.d.ts:1696API - 图71 (opens new window)


LinearScale

LinearScale: ChartComponent & { prototype: LinearScale<LinearScaleOptions> }

Defined in: index.esm.d.ts:2835API - 图72 (opens new window)


LogarithmicScale

LogarithmicScale: ChartComponent & { prototype: LogarithmicScale<LogarithmicScaleOptions> }

Defined in: index.esm.d.ts:2860API - 图73 (opens new window)


PieController

PieController: ChartComponent & { prototype: DoughnutController }

Defined in: index.esm.d.ts:318API - 图74 (opens new window)


PointElement

PointElement: ChartComponent & { prototype: PointElement<PointProps, PointOptions> }

Defined in: index.esm.d.ts:1807API - 图75 (opens new window)


PolarAreaController

PolarAreaController: ChartComponent & { prototype: PolarAreaController }

Defined in: index.esm.d.ts:346API - 图76 (opens new window)


RadarController

RadarController: ChartComponent & { prototype: RadarController }

Defined in: index.esm.d.ts:381API - 图77 (opens new window)


RadialLinearScale

RadialLinearScale: ChartComponent & { prototype: RadialLinearScale<RadialLinearScaleOptions> }

Defined in: index.esm.d.ts:3101API - 图78 (opens new window)


ScatterController

ScatterController: ChartComponent & { prototype: LineController }

Defined in: index.esm.d.ts:221API - 图79 (opens new window)


Ticks

Const Ticks: object

Type declaration:

NameType
formattersobject
formatters.logarithmic[object Object]
formatters.numeric[object Object]
formatters.values[object Object]

Defined in: index.esm.d.ts:1262API - 图80 (opens new window)


TimeScale

TimeScale: ChartComponent & { prototype: TimeScale<TimeScaleOptions> }

Defined in: index.esm.d.ts:2945API - 图81 (opens new window)


TimeSeriesScale

TimeSeriesScale: ChartComponent & { prototype: TimeSeriesScale<TimeScaleOptions> }

Defined in: index.esm.d.ts:2951API - 图82 (opens new window)


Title

Const Title: Plugin

Defined in: index.esm.d.ts:2170API - 图83 (opens new window)


Tooltip

Const Tooltip: Plugin & { positioners: { [key: string]: (items: readonly Element[], eventPosition: { x: number ; y: number }) => { x: number ; y: number }; } ; getActiveElements: () => ActiveElement[] ; setActiveElements: (active: ActiveDataPoint[], eventPosition: { x: number ; y: number }) => void }

Defined in: index.esm.d.ts:2263API - 图84 (opens new window)


_adapters

Const _adapters: object

Type declaration:

NameType
_dateDateAdapter

Defined in: adapters.d.ts:61API - 图85 (opens new window)


defaults

Const defaults: Defaults

Defined in: index.esm.d.ts:645API - 图86 (opens new window)


layouts

Const layouts: object

Type declaration:

NameType
addBox(chart: Chart<bar | line | scatter | bubble | pie | doughnut | polarArea | radar, (number | ScatterDataPoint | BubbleDataPoint)[], unknown>, item: LayoutItem) => void
configure(chart: Chart<bar | line | scatter | bubble | pie | doughnut | polarArea | radar, (number | ScatterDataPoint | BubbleDataPoint)[], unknown>, item: LayoutItem, options: { fullSize?: number ; position?: LayoutPosition ; weight?: number }) => void
removeBox(chart: Chart<bar | line | scatter | bubble | pie | doughnut | polarArea | radar, (number | ScatterDataPoint | BubbleDataPoint)[], unknown>, layoutItem: LayoutItem) => void
update(chart: Chart<bar | line | scatter | bubble | pie | doughnut | polarArea | radar, (number | ScatterDataPoint | BubbleDataPoint)[], unknown>, width: number, height: number) => void

Defined in: index.esm.d.ts:701API - 图87 (opens new window)


registerables

Const registerables: readonly ChartComponentLike[]

Defined in: index.esm.d.ts:498API - 图88 (opens new window)


registry

Const registry: Registry

Defined in: index.esm.d.ts:1054API - 图89 (opens new window)