* `afterEvent` and `beforeEvent` now receive a wrapped `event` as the `event` property of the second argument. The native event is available via `args.event.native`.
* Initial `resize` is no longer silent. Meaning that `resize` event can fire between `beforeInit` and `afterInit`
* New hooks: `install`, `start`, `stop`, and `uninstall`
+* `afterEvent` should notify about changes that need a render by setting `args.changed` to true. Because the `args` are shared with all plugins, it should only be set to true and not false.
if (chart.tooltip) {
// If the event is replayed from `update`, we should evaluate with the final positions.
const useFinalPosition = args.replay;
- chart.tooltip.handleEvent(args.event, useFinalPosition);
+ if (chart.tooltip.handleEvent(args.event, useFinalPosition)) {
+ // notify chart about the change, so it will render
+ args.changed = true;
+ }
}
},
* @param {Chart} chart - The chart instance.
* @param {object} args - The call arguments.
* @param {ChartEvent} args.event - The event object.
- * @param {boolean} replay - True if this event is replayed from `Chart.update`
+ * @param {boolean} args.replay - True if this event is replayed from `Chart.update`
+ * @param {boolean} [args.changed] - Set to true if the plugin needs a render. Should only be changed to true, because this args object is passed through all plugins.
* @param {object} options - The plugin options.
*/
- afterEvent?(chart: Chart, args: { event: ChartEvent, replay: boolean }, options: O): void;
+ afterEvent?(chart: Chart, args: { event: ChartEvent, replay: boolean, changed?: boolean }, options: O): void;
/**
* @desc Called after the chart as been resized.
* @param {Chart} chart - The chart instance.