Posts

Showing posts with the label using third party library in lwc

Charts in LWC using 3rd party JavaScript library

Image
Today, we will have a look at how to draw charts in LWC. As of today, there is no lightning component available out of the box which provides us with the ability to display charts. But the good news is that we can use third-party JavaScript libraries in LWC to display a chart. In this blog, we will see how to use a popular third party JavaScript library called Chart.js in our LWC application. Want to try the application hands-on? Install the unmanaged package in your Salesforce developer org. A working version of this application can be accessed here . You need to perform the below steps in order to use any third-party library in a lightning web component: Download the 3rd party library, zip the file and upload it as a Static Resource in your Salesforce org. You can download Charts.js from here . Please note that I have used version 2.7.3 because the latest version of Charts.js is not compatible with the locker service. I figured this out after spending a day getting the l