- Class: Chart<TType, TData, TLabel>
- Type parameters
- Constructors
- Properties
- Methods
- bindEvents
- buildOrUpdateControllers
- buildOrUpdateScales
- clear
- destroy
- draw
- ensureScalesHaveIDs
- getActiveElements
- getDataVisibility
- getDatasetMeta
- getElementsAtEventForMode
- getSortedVisibleDatasetMetas
- getVisibleDatasetCount
- hide
- isDatasetVisible
- notifyPlugins
- render
- reset
- resize
- setActiveElements
- setDatasetVisibility
- show
- stop
- toBase64Image
- toggleDataVisibility
- unbindEvents
- update
- updateHoverStyle
- getChart
- register
- unregister
Class: Chart<TType, TData, TLabel>
Type parameters
Name | Type | Default |
---|---|---|
TType | ChartType | ChartType |
TData | - | TType[] |
TLabel | - | unknown |
Constructors
constructor
+ new Chart<TType, TData, TLabel>(item
: ChartItem, config
: ChartConfiguration<TType, TData, TLabel>): Chart<TType, TData, TLabel>
Type parameters:
Name | Type | Default |
---|---|---|
TType | bar | line | scatter | bubble | pie | doughnut | polarArea | radar | bar | line | scatter | bubble | pie | doughnut | polarArea | radar |
TData | - | ChartTypeRegistry[TType][defaultDataPoint][] |
TLabel | - | unknown |
Parameters:
Name | Type |
---|---|
item | ChartItem |
config | ChartConfiguration<TType, TData, TLabel> |
Returns: Chart<TType, TData, TLabel>
Defined in: index.esm.d.ts:455 (opens new window)
Properties
aspectRatio
• Readonly
aspectRatio: number
Defined in: index.esm.d.ts:447 (opens new window)
attached
• Readonly
attached: boolean
Defined in: index.esm.d.ts:452 (opens new window)
boxes
• Readonly
boxes: LayoutItem[]
Defined in: index.esm.d.ts:448 (opens new window)
canvas
• Readonly
canvas: HTMLCanvasElement
Defined in: index.esm.d.ts:442 (opens new window)
chartArea
• Readonly
chartArea: ChartArea
Defined in: index.esm.d.ts:450 (opens new window)
config
• Readonly
config: ChartConfiguration<TType, TData, TLabel>
Defined in: index.esm.d.ts:444 (opens new window)
ctx
• Readonly
ctx: CanvasRenderingContext2D
Defined in: index.esm.d.ts:443 (opens new window)
currentDevicePixelRatio
• Readonly
currentDevicePixelRatio: number
Defined in: index.esm.d.ts:449 (opens new window)
data
• data: ChartData<TType, TData, TLabel>
Defined in: index.esm.d.ts:454 (opens new window)
height
• Readonly
height: number
Defined in: index.esm.d.ts:446 (opens new window)
id
• Readonly
id: string
Defined in: index.esm.d.ts:441 (opens new window)
options
• options: DeepPartial<CoreChartOptions<TType> & ElementChartOptions & PluginChartOptions<TType> & DatasetChartOptions<TType> & ScaleChartOptions<TType> & ChartTypeRegistry[TType][chartOptions]>
Defined in: index.esm.d.ts:455 (opens new window)
platform
• Readonly
platform: BasePlatform
Defined in: index.esm.d.ts:440 (opens new window)
scales
• Readonly
scales: object
Type declaration:
Defined in: index.esm.d.ts:451 (opens new window)
width
• Readonly
width: number
Defined in: index.esm.d.ts:445 (opens new window)
defaults
▪ Static
Readonly
defaults: Defaults
Defined in: index.esm.d.ts:494 (opens new window)
instances
▪ Static
Readonly
instances: object
Type declaration:
Defined in: index.esm.d.ts:497 (opens new window)
overrides
▪ Static
Readonly
overrides: Overrides
Defined in: index.esm.d.ts:495 (opens new window)
registry
▪ Static
Readonly
registry: Registry
Defined in: index.esm.d.ts:498 (opens new window)
version
▪ Static
Readonly
version: string
Defined in: index.esm.d.ts:496 (opens new window)
Methods
bindEvents
▸ bindEvents(): void
Returns: void
Defined in: index.esm.d.ts:488 (opens new window)
buildOrUpdateControllers
▸ buildOrUpdateControllers(): void
Returns: void
Defined in: index.esm.d.ts:465 (opens new window)
buildOrUpdateScales
▸ buildOrUpdateScales(): void
Returns: void
Defined in: index.esm.d.ts:464 (opens new window)
clear
▸ clear(): Chart<TType, TData, TLabel>
Returns: Chart<TType, TData, TLabel>
Defined in: index.esm.d.ts:459 (opens new window)
destroy
▸ destroy(): void
Returns: void
Defined in: index.esm.d.ts:486 (opens new window)
draw
▸ draw(): void
Returns: void
Defined in: index.esm.d.ts:469 (opens new window)
ensureScalesHaveIDs
▸ ensureScalesHaveIDs(): void
Returns: void
Defined in: index.esm.d.ts:463 (opens new window)
getActiveElements
▸ getActiveElements(): ActiveElement[]
Returns: ActiveElement[]
Defined in: index.esm.d.ts:483 (opens new window)
getDataVisibility
▸ getDataVisibility(index
: number): boolean
Parameters:
Name | Type |
---|---|
index | number |
Returns: boolean
Defined in: index.esm.d.ts:479 (opens new window)
getDatasetMeta
▸ getDatasetMeta(datasetIndex
: number): ChartMeta<Element<{}, {}>, Element<{}, {}>>
Parameters:
Name | Type |
---|---|
datasetIndex | number |
Returns: ChartMeta<Element<{}, {}>, Element<{}, {}>>
Defined in: index.esm.d.ts:474 (opens new window)
getElementsAtEventForMode
▸ getElementsAtEventForMode(e
: Event, mode
: string, options
: InteractionOptions, useFinalPosition
: boolean): InteractionItem[]
Parameters:
Name | Type |
---|---|
e | Event |
mode | string |
options | InteractionOptions |
useFinalPosition | boolean |
Returns: InteractionItem[]
Defined in: index.esm.d.ts:471 (opens new window)
getSortedVisibleDatasetMetas
▸ getSortedVisibleDatasetMetas(): ChartMeta<Element<{}, {}>, Element<{}, {}>>[]
Returns: ChartMeta<Element<{}, {}>, Element<{}, {}>>[]
Defined in: index.esm.d.ts:473 (opens new window)
getVisibleDatasetCount
▸ getVisibleDatasetCount(): number
Returns: number
Defined in: index.esm.d.ts:475 (opens new window)
hide
▸ hide(datasetIndex
: number): void
Parameters:
Name | Type |
---|---|
datasetIndex | number |
Returns: void
Defined in: index.esm.d.ts:480 (opens new window)
isDatasetVisible
▸ isDatasetVisible(datasetIndex
: number): boolean
Parameters:
Name | Type |
---|---|
datasetIndex | number |
Returns: boolean
Defined in: index.esm.d.ts:476 (opens new window)
notifyPlugins
▸ notifyPlugins(hook
: string, args?
: Record<string, unknown>): boolean | void
Parameters:
Name | Type |
---|---|
hook | string |
args? | Record<string, unknown> |
Returns: boolean | void
Defined in: index.esm.d.ts:492 (opens new window)
render
▸ render(): void
Returns: void
Defined in: index.esm.d.ts:468 (opens new window)
reset
▸ reset(): void
Returns: void
Defined in: index.esm.d.ts:466 (opens new window)
resize
▸ resize(width?
: number, height?
: number): void
Parameters:
Name | Type |
---|---|
width? | number |
height? | number |
Returns: void
Defined in: index.esm.d.ts:462 (opens new window)
setActiveElements
▸ setActiveElements(active
: ActiveDataPoint[]): void
Parameters:
Name | Type |
---|---|
active | ActiveDataPoint[] |
Returns: void
Defined in: index.esm.d.ts:484 (opens new window)
setDatasetVisibility
▸ setDatasetVisibility(datasetIndex
: number, visible
: boolean): void
Parameters:
Name | Type |
---|---|
datasetIndex | number |
visible | boolean |
Returns: void
Defined in: index.esm.d.ts:477 (opens new window)
show
▸ show(datasetIndex
: number): void
Parameters:
Name | Type |
---|---|
datasetIndex | number |
Returns: void
Defined in: index.esm.d.ts:481 (opens new window)
stop
▸ stop(): Chart<TType, TData, TLabel>
Returns: Chart<TType, TData, TLabel>
Defined in: index.esm.d.ts:460 (opens new window)
toBase64Image
▸ toBase64Image(type?
: string, quality?
: unknown): string
Parameters:
Name | Type |
---|---|
type? | string |
quality? | unknown |
Returns: string
Defined in: index.esm.d.ts:487 (opens new window)
toggleDataVisibility
▸ toggleDataVisibility(index
: number): void
Parameters:
Name | Type |
---|---|
index | number |
Returns: void
Defined in: index.esm.d.ts:478 (opens new window)
unbindEvents
▸ unbindEvents(): void
Returns: void
Defined in: index.esm.d.ts:489 (opens new window)
update
▸ update(mode?
: resize | reset | none | hide | show | normal | active): void
Parameters:
Name | Type |
---|---|
mode? | resize | reset | none | hide | show | normal | active |
Returns: void
Defined in: index.esm.d.ts:467 (opens new window)
updateHoverStyle
▸ updateHoverStyle(items
: Element<{}, {}>, mode
: dataset, enabled
: boolean): void
Parameters:
Name | Type |
---|---|
items | Element<{}, {}> |
mode | dataset |
enabled | boolean |
Returns: void
Defined in: index.esm.d.ts:490 (opens new window)
getChart
▸ Static
getChart(key
: string | HTMLCanvasElement | CanvasRenderingContext2D): Chart<bar | line | scatter | bubble | pie | doughnut | polarArea | radar, (number | ScatterDataPoint | BubbleDataPoint)[], unknown>
Parameters:
Name | Type |
---|---|
key | string | HTMLCanvasElement | CanvasRenderingContext2D |
Returns: Chart<bar | line | scatter | bubble | pie | doughnut | polarArea | radar, (number | ScatterDataPoint | BubbleDataPoint)[], unknown>
Defined in: index.esm.d.ts:499 (opens new window)
register
▸ Static
register(…items
: ChartComponentLike[]): void
Parameters:
Name | Type |
---|---|
…items | ChartComponentLike[] |
Returns: void
Defined in: index.esm.d.ts:500 (opens new window)
unregister
▸ Static
unregister(…items
: ChartComponentLike[]): void
Parameters:
Name | Type |
---|---|
…items | ChartComponentLike[] |
Returns: void
Defined in: index.esm.d.ts:501 (opens new window)