ChartJS Plugins - beforeDraw

Forum to discuss the new web client version of Servoy.

ChartJS Plugins - beforeDraw

Postby Louis.Winter » Fri Feb 14, 2020 4:38 pm

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:

Code: Select all
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?
Louis Winter
Journey Technology Solutions
Sioux Falls, SD USA
Louis.Winter
 
Posts: 23
Joined: Thu Dec 13, 2018 8:10 pm

Return to Servoy NGClient

Who is online

Users browsing this forum: No registered users and 5 guests