mirror of
https://github.com/chartjs/Chart.js.git
synced 2026-03-21 15:46:52 +01:00
Add new hooks for plugins (#8103)
* Notify beforeUpdate on disabled plugins cc? cc2 cc3 typo * init, unInit, enabled, disabled self review :) update the new hook signatures to unified merge error * Review update * start/stop, cc * types, jsdoc * stop between destroy and uninstall
This commit is contained in:
@@ -653,12 +653,14 @@ export default {
|
||||
*/
|
||||
_element: Legend,
|
||||
|
||||
beforeInit(chart) {
|
||||
start(chart) {
|
||||
const legendOpts = resolveOptions(chart.options.plugins.legend);
|
||||
createNewLegendAndAttach(chart, legendOpts);
|
||||
},
|
||||
|
||||
if (legendOpts) {
|
||||
createNewLegendAndAttach(chart, legendOpts);
|
||||
}
|
||||
stop(chart) {
|
||||
layouts.removeBox(chart, chart.legend);
|
||||
delete chart.legend;
|
||||
},
|
||||
|
||||
// During the beforeUpdate step, the layout configuration needs to run
|
||||
|
||||
@@ -184,11 +184,17 @@ export default {
|
||||
*/
|
||||
_element: Title,
|
||||
|
||||
beforeInit(chart, options) {
|
||||
start(chart, _args, options) {
|
||||
createTitle(chart, options);
|
||||
},
|
||||
|
||||
beforeUpdate(chart, args, options) {
|
||||
stop(chart) {
|
||||
const titleBlock = chart.titleBlock;
|
||||
layouts.removeBox(chart, titleBlock);
|
||||
delete chart.titleBlock;
|
||||
},
|
||||
|
||||
beforeUpdate(chart, _args, options) {
|
||||
if (options === false) {
|
||||
removeTitle(chart);
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user