# Class: Chart<TType, TData, TLabel>

# Type parameters

Name Type
TType extends ChartType = ChartType
TData DefaultDataPoint<TType>
TLabel unknown

# Constructors

# constructor

new Chart<TType, TData, TLabel>(item, config)

# Type parameters

Name Type
TType extends keyof ChartTypeRegistry = keyof ChartTypeRegistry
TData DistributiveArray<ChartTypeRegistry[TType]["defaultDataPoint"]>
TLabel unknown

# Parameters

Name Type
item ChartItem
config ChartConfiguration<TType, TData, TLabel> | ChartConfigurationCustomTypesPerDataset<TType, TData, TLabel>

# Defined in

types/index.d.ts:509

# Properties

# aspectRatio

Readonly aspectRatio: number

# Defined in

types/index.d.ts:496


# attached

Readonly attached: boolean

# Defined in

types/index.d.ts:501


# boxes

Readonly boxes: LayoutItem[]

# Defined in

types/index.d.ts:497


# canvas

Readonly canvas: HTMLCanvasElement

# Defined in

types/index.d.ts:491


# chartArea

Readonly chartArea: ChartArea

# Defined in

types/index.d.ts:499


# config

Readonly config: ChartConfiguration<TType, TData, TLabel> | ChartConfigurationCustomTypesPerDataset<TType, TData, TLabel>

# Defined in

types/index.d.ts:493


# ctx

Readonly ctx: CanvasRenderingContext2D

# Defined in

types/index.d.ts:492


# currentDevicePixelRatio

Readonly currentDevicePixelRatio: number

# Defined in

types/index.d.ts:498


# data

data: ChartData<TType, TData, TLabel>

# Defined in

types/index.d.ts:506


# height

Readonly height: number

# Defined in

types/index.d.ts:495


# id

Readonly id: string

# Defined in

types/index.d.ts:490


# legend

Optional Readonly legend: LegendElement<TType>

# Defined in

types/index.d.ts:503


# options

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

# Defined in

types/index.d.ts:507


# platform

Readonly platform: BasePlatform

# Defined in

types/index.d.ts:489


# scales

Readonly scales: Object

# Index signature

▪ [key: string]: Scale

# Defined in

types/index.d.ts:500


# tooltip

Optional Readonly tooltip: TooltipModel<TType>

# Defined in

types/index.d.ts:504


# width

Readonly width: number

# Defined in

types/index.d.ts:494


# defaults

Static Readonly defaults: Defaults

# Defined in

types/index.d.ts:551


# instances

Static Readonly instances: Object

# Index signature

▪ [key: string]: Chart

# Defined in

types/index.d.ts:554


# overrides

Static Readonly overrides: Overrides

# Defined in

types/index.d.ts:552


# registry

Static Readonly registry: Registry

# Defined in

types/index.d.ts:555


# version

Static Readonly version: string

# Defined in

types/index.d.ts:553

# Methods

# bindEvents

bindEvents(): void

# Returns

void

# Defined in

types/index.d.ts:541


# buildOrUpdateControllers

buildOrUpdateControllers(): void

# Returns

void

# Defined in

types/index.d.ts:517


# buildOrUpdateScales

buildOrUpdateScales(): void

# Returns

void

# Defined in

types/index.d.ts:516


# clear

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

# Returns

Chart<TType, TData, TLabel>

# Defined in

types/index.d.ts:511


# destroy

destroy(): void

# Returns

void

# Defined in

types/index.d.ts:539


# draw

draw(): void

# Returns

void

# Defined in

types/index.d.ts:521


# ensureScalesHaveIDs

ensureScalesHaveIDs(): void

# Returns

void

# Defined in

types/index.d.ts:515


# getActiveElements

getActiveElements(): ActiveElement[]

# Returns

ActiveElement[]

# Defined in

types/index.d.ts:536


# getContext

getContext(): Object

# Returns

Object

Name Type
chart Chart<keyof ChartTypeRegistry, (number | [number, number] | Point | BubbleDataPoint)[], unknown>
type string

# Defined in

types/index.d.ts:549


# getDataVisibility

getDataVisibility(index): boolean

# Parameters

Name Type
index number

# Returns

boolean

# Defined in

types/index.d.ts:532


# getDatasetMeta

getDatasetMeta(datasetIndex): ChartMeta<keyof ChartTypeRegistry, default<AnyObject, AnyObject>, default<AnyObject, AnyObject>>

# Parameters

Name Type
datasetIndex number

# Returns

ChartMeta<keyof ChartTypeRegistry, default<AnyObject, AnyObject>, default<AnyObject, AnyObject>>

# Defined in

types/index.d.ts:527


# getElementsAtEventForMode

getElementsAtEventForMode(e, mode, options, useFinalPosition): InteractionItem[]

# Parameters

Name Type
e Event
mode string
options InteractionOptions
useFinalPosition boolean

# Returns

InteractionItem[]

# Defined in

types/index.d.ts:524


# getSortedVisibleDatasetMetas

getSortedVisibleDatasetMetas(): ChartMeta<keyof ChartTypeRegistry, default<AnyObject, AnyObject>, default<AnyObject, AnyObject>>[]

# Returns

ChartMeta<keyof ChartTypeRegistry, default<AnyObject, AnyObject>, default<AnyObject, AnyObject>>[]

# Defined in

types/index.d.ts:526


# getVisibleDatasetCount

getVisibleDatasetCount(): number

# Returns

number

# Defined in

types/index.d.ts:528


# hide

hide(datasetIndex, dataIndex?): void

# Parameters

Name Type
datasetIndex number
dataIndex? number

# Returns

void

# Defined in

types/index.d.ts:533


# isDatasetVisible

isDatasetVisible(datasetIndex): boolean

# Parameters

Name Type
datasetIndex number

# Returns

boolean

# Defined in

types/index.d.ts:529


# isPluginEnabled

isPluginEnabled(pluginId): boolean

# Parameters

Name Type
pluginId string

# Returns

boolean

# Defined in

types/index.d.ts:547


# isPointInArea

isPointInArea(point): boolean

# Parameters

Name Type
point Point

# Returns

boolean

# Defined in

types/index.d.ts:523


# notifyPlugins

notifyPlugins(hook, args?): boolean | void

# Parameters

Name Type
hook string
args? AnyObject

# Returns

boolean | void

# Defined in

types/index.d.ts:545


# render

render(): void

# Returns

void

# Defined in

types/index.d.ts:520


# reset

reset(): void

# Returns

void

# Defined in

types/index.d.ts:518


# resize

resize(width?, height?): void

# Parameters

Name Type
width? number
height? number

# Returns

void

# Defined in

types/index.d.ts:514


# setActiveElements

setActiveElements(active): void

# Parameters

Name Type
active ActiveDataPoint[]

# Returns

void

# Defined in

types/index.d.ts:537


# setDatasetVisibility

setDatasetVisibility(datasetIndex, visible): void

# Parameters

Name Type
datasetIndex number
visible boolean

# Returns

void

# Defined in

types/index.d.ts:530


# show

show(datasetIndex, dataIndex?): void

# Parameters

Name Type
datasetIndex number
dataIndex? number

# Returns

void

# Defined in

types/index.d.ts:534


# stop

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

# Returns

Chart<TType, TData, TLabel>

# Defined in

types/index.d.ts:512


# toBase64Image

toBase64Image(type?, quality?): string

# Parameters

Name Type
type? string
quality? unknown

# Returns

string

# Defined in

types/index.d.ts:540


# toggleDataVisibility

toggleDataVisibility(index): void

# Parameters

Name Type
index number

# Returns

void

# Defined in

types/index.d.ts:531


# unbindEvents

unbindEvents(): void

# Returns

void

# Defined in

types/index.d.ts:542


# update

update(mode?): void

# Parameters

Name Type
mode? "none" | "hide" | "show" | "default" | "active" | "resize" | "reset" | (ctx: { datasetIndex: number }) => "none" | "hide" | "show" | "default" | "active" | "resize" | "reset"

# Returns

void

# Defined in

types/index.d.ts:519


# updateHoverStyle

updateHoverStyle(items, mode, enabled): void

# Parameters

Name Type
items InteractionItem[]
mode "dataset"
enabled boolean

# Returns

void

# Defined in

types/index.d.ts:543


# getChart

Static getChart(key): Chart<keyof ChartTypeRegistry, (number | [number, number] | Point | BubbleDataPoint)[], unknown>

# Parameters

Name Type
key string | HTMLCanvasElement | CanvasRenderingContext2D

# Returns

Chart<keyof ChartTypeRegistry, (number | [number, number] | Point | BubbleDataPoint)[], unknown>

# Defined in

types/index.d.ts:556


# register

Static register(...items): void

# Parameters

Name Type
...items ChartComponentLike[]

# Returns

void

# Defined in

types/index.d.ts:557


# unregister

Static unregister(...items): void

# Parameters

Name Type
...items ChartComponentLike[]

# Returns

void

# Defined in

types/index.d.ts:558