Pages

Tuesday, January 30, 2018

Using Chartjs in Lightning Components

ChartJS provides interactive and animated HTML 5 based javaScript charts. We can use these in Lightning components to display charts.

I have created a sample lightning app which display different charts by using salesforce data.

I am going to display opportunities amount(in millions) grouped by forecast category. First of all store the Chartjs file in static resource in order to use it in lightning components.

Download the Chartjs file which I am using from this link Chartjs download


You can download complete code along with static resource from below Github repository and deploy to your org.

Chartjs-in-Lightning-Sample-Code

Below is sample code used to display charts in above snapshot.


Hope this will help!!


5 comments:

  1. Hi,
    if you change the point style line, locker service not work, check this:

    https://developer.salesforce.com/forums/?id=9060G0000005ajXQAQ

    ReplyDelete
  2. Can you use custom objects for the charts???

    ReplyDelete
  3. How can you make the charts larger?

    ReplyDelete
  4. I unquestionably truly loved all aspects about free page view tracker USA and I likewise have you spared to fav to take a gander at new data in your site.

    ReplyDelete