C3.JS chart loaded event

Viewed 1690

I use C3 to print a graph. However, I have a lot of data, so the loading time can takes several seconds.

What I wanted to do is to put a spinning wheel while C3 loads the data and prints the graph.

To do so, I have a function which:

  • starts the spin
  • load the data in the graph thanks to the chart.load()function (the chart is already created)
  • stops the spin at the end of the function

Unfortunately, the data must be loaded in a callback function inside C3 because my function returns before the graph is displayed (and my spinning wheel stops several seconds before the data are displayed in the graph).

Thus, I wonder if there is an event in C3 that says "hey! the graph is now correctly displayed" so I can stop the spin at this moment. Something like

chart.onFullyLoaded(function() {spin.stop()});

Do you know if such a function exists, or how I can manage to have this behavior?

0 Answers
Related