mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-12-04 12:11:47 +00:00
Update types/chart.js (#36137)
Change-Id: Iebb8421829a54958710130737b5cf6cbd80e9788
This commit is contained in:
committed by
Daniel Rosenwasser
parent
527e35da80
commit
1611b14d95
@@ -5,7 +5,7 @@ import { Chart, ChartData, Point } from "chart.js";
|
||||
// => chartjs.Chart
|
||||
|
||||
const plugin = {
|
||||
afterDraw: (chartInstance: Chart, easing: string, options?: any) => {
|
||||
afterDraw: (chartInstance: Chart, easing: Chart.Easing, options?: any) => {
|
||||
}
|
||||
};
|
||||
|
||||
@@ -79,7 +79,7 @@ const chart: Chart = new Chart(ctx, {
|
||||
}
|
||||
}
|
||||
});
|
||||
chart.update();
|
||||
chart.update({duration: 500, lazy: false, easing: 'linear'});
|
||||
|
||||
console.log(chart.getDatasetMeta(0));
|
||||
|
||||
|
||||
Vendored
+28
-10
@@ -16,6 +16,7 @@
|
||||
// Conrad Holtzhausen <https://github.com/Conrad777>
|
||||
// Adrián Caballero <https://github.com/adripanico>
|
||||
// wertzui <https://github.com/wertzui>
|
||||
// Martin Trobäck <https://github.com/lekoaf>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.3
|
||||
|
||||
@@ -28,8 +29,8 @@ declare class Chart {
|
||||
config: Chart.ChartConfiguration;
|
||||
data: Chart.ChartData;
|
||||
destroy: () => {};
|
||||
update: (duration?: any, lazy?: any) => {};
|
||||
render: (duration?: any, lazy?: any) => {};
|
||||
update: ({duration, lazy, easing}?: Chart.ChartUpdateProps) => {};
|
||||
render: ({duration, lazy, easing}?: Chart.ChartRenderProps) => {};
|
||||
stop: () => {};
|
||||
resize: () => {};
|
||||
clear: () => {};
|
||||
@@ -123,6 +124,11 @@ declare namespace Chart {
|
||||
|
||||
type InteractionMode = 'point' | 'nearest' | 'single' | 'label' | 'index' | 'x-axis' | 'dataset' | 'x' | 'y';
|
||||
|
||||
type Easing = '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';
|
||||
|
||||
interface ChartArea {
|
||||
top: number;
|
||||
right: number;
|
||||
@@ -336,7 +342,7 @@ declare namespace Chart {
|
||||
interface ChartAnimationObject {
|
||||
currentStep?: number;
|
||||
numSteps?: number;
|
||||
easing?: string;
|
||||
easing?: Easing;
|
||||
render?(arg: any): void;
|
||||
onAnimationProgress?(arg: any): void;
|
||||
onAnimationComplete?(arg: any): void;
|
||||
@@ -344,7 +350,7 @@ declare namespace Chart {
|
||||
|
||||
interface ChartAnimationOptions {
|
||||
duration?: number;
|
||||
easing?: string;
|
||||
easing?: Easing;
|
||||
onProgress?(chart: any): void;
|
||||
onComplete?(chart: any): void;
|
||||
animateRotate?: boolean;
|
||||
@@ -660,15 +666,15 @@ declare namespace Chart {
|
||||
afterRender?(chartInstance: Chart, options?: any): void;
|
||||
|
||||
// Easing is for animation
|
||||
beforeDraw?(chartInstance: Chart, easing: string, options?: any): void;
|
||||
afterDraw?(chartInstance: Chart, easing: string, options?: any): void;
|
||||
beforeDraw?(chartInstance: Chart, easing: Easing, options?: any): void;
|
||||
afterDraw?(chartInstance: Chart, easing: Easing, options?: any): void;
|
||||
|
||||
// Before the datasets are drawn but after scales are drawn
|
||||
beforeDatasetsDraw?(chartInstance: Chart, easing: string, options?: any): void;
|
||||
afterDatasetsDraw?(chartInstance: Chart, easing: string, options?: any): void;
|
||||
beforeDatasetsDraw?(chartInstance: Chart, easing: Easing, options?: any): void;
|
||||
afterDatasetsDraw?(chartInstance: Chart, easing: Easing, options?: any): void;
|
||||
|
||||
beforeDatasetDraw?(chartInstance: Chart, easing: string, options?: any): void;
|
||||
afterDatasetDraw?(chartInstance: Chart, easing: string, options?: any): void;
|
||||
beforeDatasetDraw?(chartInstance: Chart, easing: Easing, options?: any): void;
|
||||
afterDatasetDraw?(chartInstance: Chart, easing: Easing, options?: any): void;
|
||||
|
||||
// Called before drawing the `tooltip`. If any plugin returns `false`,
|
||||
// the tooltip drawing is cancelled until another `render` is triggered.
|
||||
@@ -687,6 +693,18 @@ declare namespace Chart {
|
||||
/** @deprecated since version 2.5.0. Use `afterLayout` instead. */
|
||||
afterScaleUpdate?(chartInstance: Chart, options?: any): void;
|
||||
}
|
||||
|
||||
interface ChartUpdateProps {
|
||||
duration?: number;
|
||||
lazy?: boolean;
|
||||
easing?: Easing;
|
||||
}
|
||||
|
||||
interface ChartRenderProps {
|
||||
duration?: number;
|
||||
lazy?: boolean;
|
||||
easing?: Easing;
|
||||
}
|
||||
}
|
||||
|
||||
export = Chart;
|
||||
|
||||
Reference in New Issue
Block a user