Skip to content

Commit 6fe3037

Browse files
authored
Updated plugin interface to drop legacy methods
1 parent cefdb10 commit 6fe3037

File tree

1 file changed

+13
-11
lines changed

1 file changed

+13
-11
lines changed

src/controls/chartControl/ChartControl.types.ts

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,7 @@ export interface IChartAccessibility {
238238
* Use this interface if you'd like to create a plugin
239239
*/
240240
export interface IChartPlugin {
241-
beforeInit?(chartInstance: Chart, options?: {}): void;
241+
beforeInit?(chartInstance: Chart, options?: {}): void;
242242
afterInit?(chartInstance: Chart, options?: {}): void;
243243

244244
beforeUpdate?(chartInstance: Chart, options?: {}): void;
@@ -250,32 +250,34 @@ export interface IChartPlugin {
250250
beforeDatasetsUpdate?(chartInstance: Chart, options?: {}): void;
251251
afterDatasetsUpdate?(chartInstance: Chart, options?: {}): void;
252252

253-
beforeDatasetUpdate?(chartInstance: Chart, options?: {}): void;
254-
afterDatasetUpdate?(chartInstance: Chart, options?: {}): void;
255-
253+
// This is called at the start of a render.
254+
// It is only called once, even if the animation will run
255+
// for a number of frames. Use beforeDraw or afterDraw
256+
// to do something on each animation frame
256257
beforeRender?(chartInstance: Chart, options?: {}): void;
257258
afterRender?(chartInstance: Chart, options?: {}): void;
258259

260+
// Easing is for animation
259261
beforeDraw?(chartInstance: Chart, easing: string, options?: {}): void;
260262
afterDraw?(chartInstance: Chart, easing: string, options?: {}): void;
261263

264+
// Before the datasets are drawn but after scales are drawn
262265
beforeDatasetsDraw?(chartInstance: Chart, easing: string, options?: {}): void;
263266
afterDatasetsDraw?(chartInstance: Chart, easing: string, options?: {}): void;
264267

265-
beforeDatasetDraw?(chartInstance: Chart, easing: string, options?: {}): void;
266-
afterDatasetDraw?(chartInstance: Chart, easing: string, options?: {}): void;
267-
268+
// Called before drawing the `tooltip`. If any plugin returns `false`,
269+
// the tooltip drawing is cancelled until another `render` is triggered.
268270
beforeTooltipDraw?(chartInstance: Chart, tooltipData?: {}, options?: {}): void;
271+
// Called after drawing the `tooltip`. Note that this hook will not,
272+
// be called if the tooltip drawing has been previously cancelled.
269273
afterTooltipDraw?(chartInstance: Chart, tooltipData?: {}, options?: {}): void;
270274

275+
// Called when an event occurs on the chart
271276
beforeEvent?(chartInstance: Chart, event: Event, options?: {}): void;
272277
afterEvent?(chartInstance: Chart, event: Event, options?: {}): void;
273278

274-
resize?(chartInstance: Chart, newChartSize: Chart.ChartSize, options?: {}): void;
279+
resize?(chartInstance: Chart, newChartSize: Chart.ChartSize, options?: any): void;
275280
destroy?(chartInstance: Chart): void;
276-
277-
/** @deprecated Use `afterLayout` instead. */
278-
afterScaleUpdate?(chartInstance: Chart, options?: {}): void;
279281
}
280282

281283
/**

0 commit comments

Comments
 (0)