Class: Chart<TType, TData, TLabel>

Type parameters

NameTypeDefault
TTypeChartTypeChartType
TData-TType[]
TLabel-unknown

Constructors

constructor

+ new Chart<TType, TData, TLabel>(item: ChartItem, config: ChartConfiguration<TType, TData, TLabel>): Chart<TType, TData, TLabel>

Type parameters:

NameTypeDefault
TTypebar | line | scatter | bubble | pie | doughnut | polarArea | radarbar | line | scatter | bubble | pie | doughnut | polarArea | radar
TData-ChartTypeRegistry[TType][defaultDataPoint][]
TLabel-unknown

Parameters:

NameType
itemChartItem
configChartConfiguration<TType, TData, TLabel>

Returns: Chart<TType, TData, TLabel>

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

Properties

aspectRatio

Readonly aspectRatio: number

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


attached

Readonly attached: boolean

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


boxes

Readonly boxes: LayoutItem[]

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


canvas

Readonly canvas: HTMLCanvasElement

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


chartArea

Readonly chartArea: ChartArea

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


config

Readonly config: ChartConfiguration<TType, TData, TLabel>

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


ctx

Readonly ctx: CanvasRenderingContext2D

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


currentDevicePixelRatio

Readonly currentDevicePixelRatio: number

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


data

data: ChartData<TType, TData, TLabel>

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


height

Readonly height: number

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


id

Readonly id: string

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


options

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

Defined in: index.esm.d.ts:455Chart - 图13 (opens new window)


platform

Readonly platform: BasePlatform

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


scales

Readonly scales: object

Type declaration:

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


width

Readonly width: number

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


defaults

Static Readonly defaults: Defaults

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


instances

Static Readonly instances: object

Type declaration:

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


overrides

Static Readonly overrides: Overrides

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


registry

Static Readonly registry: Registry

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


version

Static Readonly version: string

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

Methods

bindEvents

bindEvents(): void

Returns: void

Defined in: index.esm.d.ts:488Chart - 图22 (opens new window)


buildOrUpdateControllers

buildOrUpdateControllers(): void

Returns: void

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


buildOrUpdateScales

buildOrUpdateScales(): void

Returns: void

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


clear

clear(): Chart<TType, TData, TLabel>

Returns: Chart<TType, TData, TLabel>

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


destroy

destroy(): void

Returns: void

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


draw

draw(): void

Returns: void

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


ensureScalesHaveIDs

ensureScalesHaveIDs(): void

Returns: void

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


getActiveElements

getActiveElements(): ActiveElement[]

Returns: ActiveElement[]

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


getDataVisibility

getDataVisibility(index: number): boolean

Parameters:

NameType
indexnumber

Returns: boolean

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


getDatasetMeta

getDatasetMeta(datasetIndex: number): ChartMeta<Element<{}, {}>, Element<{}, {}>>

Parameters:

NameType
datasetIndexnumber

Returns: ChartMeta<Element<{}, {}>, Element<{}, {}>>

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


getElementsAtEventForMode

getElementsAtEventForMode(e: Event, mode: string, options: InteractionOptions, useFinalPosition: boolean): InteractionItem[]

Parameters:

NameType
eEvent
modestring
optionsInteractionOptions
useFinalPositionboolean

Returns: InteractionItem[]

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


getSortedVisibleDatasetMetas

getSortedVisibleDatasetMetas(): ChartMeta<Element<{}, {}>, Element<{}, {}>>[]

Returns: ChartMeta<Element<{}, {}>, Element<{}, {}>>[]

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


getVisibleDatasetCount

getVisibleDatasetCount(): number

Returns: number

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


hide

hide(datasetIndex: number): void

Parameters:

NameType
datasetIndexnumber

Returns: void

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


isDatasetVisible

isDatasetVisible(datasetIndex: number): boolean

Parameters:

NameType
datasetIndexnumber

Returns: boolean

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


notifyPlugins

notifyPlugins(hook: string, args?: Record<string, unknown>): boolean | void

Parameters:

NameType
hookstring
args?Record<string, unknown>

Returns: boolean | void

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


render

render(): void

Returns: void

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


reset

reset(): void

Returns: void

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


resize

resize(width?: number, height?: number): void

Parameters:

NameType
width?number
height?number

Returns: void

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


setActiveElements

setActiveElements(active: ActiveDataPoint[]): void

Parameters:

NameType
activeActiveDataPoint[]

Returns: void

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


setDatasetVisibility

setDatasetVisibility(datasetIndex: number, visible: boolean): void

Parameters:

NameType
datasetIndexnumber
visibleboolean

Returns: void

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


show

show(datasetIndex: number): void

Parameters:

NameType
datasetIndexnumber

Returns: void

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


stop

stop(): Chart<TType, TData, TLabel>

Returns: Chart<TType, TData, TLabel>

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


toBase64Image

toBase64Image(type?: string, quality?: unknown): string

Parameters:

NameType
type?string
quality?unknown

Returns: string

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


toggleDataVisibility

toggleDataVisibility(index: number): void

Parameters:

NameType
indexnumber

Returns: void

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


unbindEvents

unbindEvents(): void

Returns: void

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


update

update(mode?: resize | reset | none | hide | show | normal | active): void

Parameters:

NameType
mode?resize | reset | none | hide | show | normal | active

Returns: void

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


updateHoverStyle

updateHoverStyle(items: Element<{}, {}>, mode: dataset, enabled: boolean): void

Parameters:

NameType
itemsElement<{}, {}>
modedataset
enabledboolean

Returns: void

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


getChart

StaticgetChart(key: string | HTMLCanvasElement | CanvasRenderingContext2D): Chart<bar | line | scatter | bubble | pie | doughnut | polarArea | radar, (number | ScatterDataPoint | BubbleDataPoint)[], unknown>

Parameters:

NameType
keystring | HTMLCanvasElement | CanvasRenderingContext2D

Returns: Chart<bar | line | scatter | bubble | pie | doughnut | polarArea | radar, (number | ScatterDataPoint | BubbleDataPoint)[], unknown>

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


register

Staticregister(…items: ChartComponentLike[]): void

Parameters:

NameType
…itemsChartComponentLike[]

Returns: void

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


unregister

Staticunregister(…items: ChartComponentLike[]): void

Parameters:

NameType
…itemsChartComponentLike[]

Returns: void

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