Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

C3 Graphs On Load Callback [closed]

I want to use some kind of callback function that will run some code once the C3 Graph is finished loading so that I can change the fill colors of certain points.

like image 737
Ricky Avatar asked Nov 19 '14 22:11

Ricky


People also ask

What is C3 and D3?

js is a JavaScript library for manipulating documents based on data. c3. js is a Javascript library which makes it easy to generate D3-based charts (less code to write). highchart is a Javascript charting framework.

What is C3 Javascript?

This library is used to create a dynamic and interactive data visualizations. C3 is a library build on top of D3. C3 is d3 based reusable chart library and most important advantage of using c3 is that you don't have to know D3 or write those long codes!.


1 Answers

Don't load any data in the initialization. Rather explicitly call the load event and pass the data in. Then you have access to the done callback.

var chart = c3.generate({ /*...*/ });

chart.load({
  columns: [['data1, 100, 200, 150, ...],
    ...
  ],
  done: function() { /* whatever you need done here... */}
});
like image 147
Sean Avatar answered Sep 30 '22 02:09

Sean