So I have a plugin that does a custom drawing after the event "afterDraw". I'd like to be able hide the drawing by overriding the legend box onClick method and animating the hiding part using the charts default animation options. Is there any function I can call using the id for my plugin? Thanks in advance.
Example of my my code: The addLabel part just does the drawing, no more than that.
plugins: [{
id : 'drawLabelPlugin',
afterDraw: function(chart, args, options) {
var chartInstance = chart;
ctx = chartInstance.ctx;
chartInstance.data.datasets.forEach(function (dataset, i) { //For each type of chart
var defaultFont = '11.5px -apple-system, system-ui, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol"';
ctx.textAlign = 'start';
ctx.textBaseline = 'bottom';
meta = chartInstance.getDatasetMeta(i);
if(meta.label == ma1title/* && !meta.hidden*/){
var last = meta.data.length - 1;
addLabel(defaultFont, 12.5, '#2c6288', '#ffffff', '#2c6288', 1.3, meta.data[last].x, meta.data[last].y, dataset.data[last].y, 7.65, 6.1, false);
}
}