mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-10-04 06:47:03 +00:00
Merge pull request #26169 from gebeto/master
chart.js - improve Chart and PluginServiceRegistrationOptions
This commit is contained in:
Vendored
+20
-18
@@ -11,6 +11,7 @@
|
||||
// Sergey Rubanov <https://github.com/chicoxyzzy>
|
||||
// Simon Archer <https://github.com/archy-bold>
|
||||
// Ken Elkabany <https://github.com/braincore>
|
||||
// Slavik Nychkalo <https://github.com/gebeto>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.3
|
||||
|
||||
@@ -37,6 +38,7 @@ declare class Chart {
|
||||
canvas: HTMLCanvasElement|null;
|
||||
chartArea: Chart.ChartArea;
|
||||
static pluginService: PluginServiceStatic;
|
||||
static plugins: PluginServiceStatic;
|
||||
|
||||
static defaults: {
|
||||
global: Chart.ChartOptions & Chart.ChartFontOptions;
|
||||
@@ -56,40 +58,40 @@ declare class PluginServiceStatic {
|
||||
}
|
||||
|
||||
interface PluginServiceRegistrationOptions {
|
||||
beforeInit?(chartInstance: Chart): void;
|
||||
afterInit?(chartInstance: Chart): void;
|
||||
beforeInit?(chartInstance: Chart, options?: any): void;
|
||||
afterInit?(chartInstance: Chart, options?: any): void;
|
||||
|
||||
resize?(chartInstance: Chart, newChartSize: Size): void;
|
||||
resize?(chartInstance: Chart, newChartSize: Size, options?: any): void;
|
||||
|
||||
beforeUpdate?(chartInstance: Chart): void;
|
||||
afterScaleUpdate?(chartInstance: Chart): void;
|
||||
beforeDatasetsUpdate?(chartInstance: Chart): void;
|
||||
afterDatasetsUpdate?(chartInstance: Chart): void;
|
||||
afterUpdate?(chartInstance: Chart): void;
|
||||
beforeUpdate?(chartInstance: Chart, options?: any): void;
|
||||
afterScaleUpdate?(chartInstance: Chart, options?: any): void;
|
||||
beforeDatasetsUpdate?(chartInstance: Chart, options?: any): void;
|
||||
afterDatasetsUpdate?(chartInstance: Chart, options?: any): void;
|
||||
afterUpdate?(chartInstance: Chart, options?: any): void;
|
||||
|
||||
// This is called at the start of a render. It is only called once, even if the animation will run for a number of frames. Use beforeDraw or afterDraw
|
||||
// to do something on each animation frame
|
||||
beforeRender?(chartInstance: Chart): void;
|
||||
beforeRender?(chartInstance: Chart, options?: any): void;
|
||||
|
||||
// Easing is for animation
|
||||
beforeDraw?(chartInstance: Chart, easing: string): void;
|
||||
afterDraw?(chartInstance: Chart, easing: string): void;
|
||||
beforeDraw?(chartInstance: Chart, easing: string, options?: any): void;
|
||||
afterDraw?(chartInstance: Chart, easing: string, options?: any): void;
|
||||
// Before the datasets are drawn but after scales are drawn
|
||||
beforeDatasetsDraw?(chartInstance: Chart, easing: string): void;
|
||||
afterDatasetsDraw?(chartInstance: Chart, easing: string): void;
|
||||
beforeDatasetsDraw?(chartInstance: Chart, easing: string, options?: any): void;
|
||||
afterDatasetsDraw?(chartInstance: Chart, easing: string, options?: any): void;
|
||||
|
||||
// Called before drawing the `tooltip`. If any plugin returns `false`,
|
||||
// the tooltip drawing is cancelled until another `render` is triggered.
|
||||
beforeTooltipDraw?(chartInstance: Chart): void;
|
||||
beforeTooltipDraw?(chartInstance: Chart, tooltipData?: any, options?: any): void;
|
||||
// Called after drawing the `tooltip`. Note that this hook will not,
|
||||
// be called if the tooltip drawing has been previously cancelled.
|
||||
afterTooltipDraw?(chartInstance: Chart): void;
|
||||
afterTooltipDraw?(chartInstance: Chart, tooltipData?: any, options?: any): void;
|
||||
|
||||
destroy?(chartInstance: Chart): void;
|
||||
|
||||
// Called when an event occurs on the chart
|
||||
beforeEvent?(chartInstance: Chart, event: Event): void;
|
||||
afterEvent?(chartInstance: Chart, event: Event): void;
|
||||
beforeEvent?(chartInstance: Chart, event: Event, options?: any): void;
|
||||
afterEvent?(chartInstance: Chart, event: Event, options?: any): void;
|
||||
}
|
||||
|
||||
interface Size {
|
||||
@@ -98,7 +100,7 @@ interface Size {
|
||||
}
|
||||
|
||||
declare namespace Chart {
|
||||
type ChartType = 'line' | 'bar' | 'radar' | 'doughnut' | 'polarArea' | 'bubble' | 'pie';
|
||||
type ChartType = 'line' | 'bar' | 'horizontalBar' | 'radar' | 'doughnut' | 'polarArea' | 'bubble' | 'pie';
|
||||
|
||||
type TimeUnit = 'millisecond' | 'second' | 'minute' | 'hour' | 'day' | 'week' | 'month' | 'quarter' | 'year';
|
||||
|
||||
|
||||
Reference in New Issue
Block a user