mirror of
https://github.com/chartjs/Chart.js.git
synced 2026-03-12 03:06:54 +01:00
Merge Chart instance with Chart factory (#7783)
Co-authored-by: Sergey Khomushin <sergey@placer.io>
This commit is contained in:
24
types/core/index.d.ts
vendored
24
types/core/index.d.ts
vendored
@@ -232,7 +232,7 @@ export interface IParsingOptions {
|
||||
| false;
|
||||
}
|
||||
|
||||
export interface Chart<TYPE extends IChartType = IChartType, DATA extends unknown[] = unknown[], LABEL = string> {
|
||||
export declare class Chart<TYPE extends IChartType = IChartType, DATA extends unknown[] = unknown[], LABEL = string> {
|
||||
readonly platform: BasePlatform;
|
||||
readonly id: string;
|
||||
readonly canvas: HTMLCanvasElement;
|
||||
@@ -251,6 +251,8 @@ export interface Chart<TYPE extends IChartType = IChartType, DATA extends unknow
|
||||
data: IChartConfiguration<TYPE, DATA, LABEL>['data'];
|
||||
options: IChartConfiguration<TYPE, DATA, LABEL>['options'];
|
||||
|
||||
constructor(item: ChartItem, config: IChartConfiguration<TYPE, DATA, LABEL>);
|
||||
|
||||
clear(): this;
|
||||
stop(): this;
|
||||
|
||||
@@ -284,6 +286,12 @@ export interface Chart<TYPE extends IChartType = IChartType, DATA extends unknow
|
||||
bindEvents(): void;
|
||||
unbindEvents(): void;
|
||||
updateHoverStyle(items: Element, mode: 'dataset', enabled: boolean): void;
|
||||
|
||||
static readonly version: string;
|
||||
static readonly instances: { [key: string]: Chart };
|
||||
static readonly registry: Registry;
|
||||
static register(...items: IChartComponentLike[]): void;
|
||||
static unregister(...items: IChartComponentLike[]): void;
|
||||
}
|
||||
|
||||
export declare type ChartItem =
|
||||
@@ -295,20 +303,6 @@ export declare type ChartItem =
|
||||
| { canvas: HTMLCanvasElement | OffscreenCanvas }
|
||||
| ArrayLike<CanvasRenderingContext2D | HTMLCanvasElement | OffscreenCanvas>;
|
||||
|
||||
export const Chart: {
|
||||
prototype: Chart;
|
||||
new <TYPE extends IChartType = IChartType, DATA extends unknown[] = unknown[], LABEL = string>(
|
||||
item: ChartItem,
|
||||
config: IChartConfiguration<TYPE, DATA, LABEL>
|
||||
): Chart<TYPE, DATA, LABEL>;
|
||||
|
||||
readonly version: string;
|
||||
readonly instances: { [key: string]: Chart };
|
||||
readonly registry: Registry;
|
||||
register(...items: IChartComponentLike[]): void;
|
||||
unregister(...items: IChartComponentLike[]): void;
|
||||
};
|
||||
|
||||
export enum UpdateModeEnum {
|
||||
resize = 'resize',
|
||||
reset = 'reset',
|
||||
|
||||
Reference in New Issue
Block a user