I wanted to try out some charting on LWC and I thought what better framework than C3. In this post we will see a component which will display opportunities in various statues associated to an account.
As a prerequisite you would need c3 and d3 (c3 has a dependency on d3.js) framework loaded in static resource for the charting to work .
Download the latest version of the C3 and D3 from below.
Couple of important points for charting:
- Load the dependency in the same order that I mentioned below. D3 first and then follow it up with C3.
We have added the a parameter t and assigned the current time to it.This is done to make sure the cache is refreshed every time the scripts are loaded.If we do not do this then there is an issues if we add multiple charts in a single component.
This is just a simple example for one to start with C3. Please share the beautiful charts that you build. Enjoy Charting!!!