-
Notifications
You must be signed in to change notification settings - Fork 22
[BLOCKER] There is no way to use Google Chart API Inside Salesforce LWC :( :( :( #2962
Description
I would like to use Google Chart API inside Salesforce LWC, however, Salesforce Lightning Locker Security forbids to use external sites since it considers calls to external sites to be dangerous and forbidden by CSP and CORS.
This is the definition of Salesforce Locker-compliant JS libraries.
Salesforce insists that any external library should be downloaded and uploaded into Salesforce as a Static Resource and shouldn't call external resources like https://www.gstatic.com/.
On the other side, Google says basically that it forbids to download the library or host it on the other cloud platforms and insists that it should call https://www.gstatic.com/.
Can I use charts offline?
Your users' computers must have access to https://www.gstatic.com/charts/loader.js in order to use the interactive features of Google Charts. This is because the visualization libraries that your page requires are loaded dynamically before you use them. The code for loading the appropriate library is part of the included script, and is called when you invoke the google.charts.load() method. Our [terms of service](https://developers.google.com/chart/terms) do not allow you to download the google.charts.load or google.visualization code to use offline.
Can I download and host the chart code locally, or on an intranet?
Sorry; our [terms of service](https://developers.google.com/chart/terms) do not allow you to download and save or host the google.charts.load or google.visualization code. However, if you don't need the interactivity of Google Charts, you can screenshot the charts and use them as you wish.
Looks like Salesforce and Google policies are contradictory and will not allow to use Google Chart API inside Salesforce LWC.
Maybe there is some workaround or hack?
I don't completely understand what is meant by 'interactive features', can I just download the only one chart like pie chart and use it in LWC on Salesforce?