mirror of
https://github.com/chartjs/Chart.js.git
synced 2025-12-08 20:36:08 +00:00
Move register/unregister to core.controller (#7626)
This commit is contained in:
parent
4f6d9d8440
commit
572b1c737e
@ -1181,4 +1181,16 @@ Chart.instances = {};
|
||||
|
||||
Chart.registry = registry;
|
||||
|
||||
// @ts-ignore
|
||||
const invalidatePlugins = () => each(Chart.instances, (chart) => chart._plugins.invalidate());
|
||||
|
||||
Chart.register = (...items) => {
|
||||
registry.add(...items);
|
||||
invalidatePlugins();
|
||||
};
|
||||
Chart.unregister = (...items) => {
|
||||
registry.remove(...items);
|
||||
invalidatePlugins();
|
||||
};
|
||||
|
||||
export default Chart;
|
||||
|
||||
14
src/index.js
14
src/index.js
@ -23,21 +23,9 @@ import registry from './core/core.registry';
|
||||
import Scale from './core/core.scale';
|
||||
import * as scales from './scales';
|
||||
import Ticks from './core/core.ticks';
|
||||
import {each} from './helpers/helpers.core';
|
||||
|
||||
// @ts-ignore
|
||||
const invalidatePlugins = () => each(Chart.instances, (chart) => chart._plugins.invalidate());
|
||||
|
||||
Chart.register = (...items) => {
|
||||
registry.add(...items);
|
||||
invalidatePlugins();
|
||||
};
|
||||
Chart.unregister = (...items) => {
|
||||
registry.remove(...items);
|
||||
invalidatePlugins();
|
||||
};
|
||||
|
||||
// Register built-ins
|
||||
// @ts-ignore
|
||||
Chart.register(controllers, scales, elements, plugins);
|
||||
|
||||
Chart.helpers = helpers;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user