Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Invoke callback function after zingChart.render()

I am rendering scatter plot using ZingChart.render() method. It is working fine and giving me the expected result.

I want to execute some code after graph rendering is completed. Since the JS code gets executed in an asynchronous manner, the code which I want to execute after graph rendering gets executed before the graph is rendered.

Is there any method in JS/ZingChart through which I can successfully execute some code after ZingChart's rendering is completed.

SampleCode.js

 zingchart.render({ 
      id:'chartDiv',
      data:chartData,
      height:400,
      width:600
    });

Sample line which need to be executed after ZingChart rendering is completed

performance.now()

Regards

Ajay

like image 268
Ajay Avatar asked Jun 28 '16 09:06

Ajay


1 Answers

zing chart provides callbacks:

zingchart.render({ 
  id:'chartDiv',
  data:chartData,
  height:400,
  width:600,
  events: {
     complete: function(p) {
          alert('complete');
     }
  }
});

Reference: https://www.zingchart.com/docs/developers/zingchart-object-and-methods/#render-method

hope this helps

like image 127
Martin Ackermann Avatar answered Nov 05 '22 14:11

Martin Ackermann