This Gist explains how to draw a Sankey chart on the Salesforce Platform with Lightning Web Components. We use the Chart.js library and the chartjs-chart-sankey plugin. For the sake of simplicy we start from an existing Salesforce project: LWC Recipes.
- Install LWC Recipes and make sure that you can see the Chart.js recipe located in the 3rd Party Libs tab.
- Enable Lightning Web Security or you'll get the following error message:
TypeError: ResizeObserver is not a constructor
- Download the latest version of the chartjs-chart-sankey plugin from this CDN link and rename the file to
chartJsSankey.js
.