Has anyone successfully implemented any of the plugins (such as beforeDraw) that receive the chart as an argument? I have been able to setup a beforeDraw function that get’s called, but the ‘chart’ argument is always undefined. Without this argument the event is kind of useless.
svyChartJS version 1.0.4
Current logic:
var pieCenterTextPlugin = {
beforeDrawParams: ['chart'],
beforeDraw: function(chart) {
console.log(chart);
console.log(arguments);
console.log(this);
return true;
}
}
var pieOptions = {
plugins: {
beforeDraw: { isFunction: true, params: pieCenterTextPlugin.beforeDrawParams,
expression: scopes.stringUtils.fnToString(pieCenterTextPlugin.beforeDraw)}
}
chartPie.setOptions(pieOptions);
Result (from browser log), it’s kind of ugly but that’s how Chrome exports it:
sablo_app.js:23 undefined
sablo_app.js:23 Arguments [callee: ƒ, Symbol(Symbol.iterator): ƒ]length: 0 callee: ƒ anonymous(chart )Symbol(Symbol.iterator): ƒ values()proto: Object
sablo_app.js:23 Window {parent: Window, opener: null, top: Window, length: 0, frames: Window, …}document: documentname: ""customElements: CustomElementRegistry {}history: …
Thoughts?