Page 1 of 1

Google Charts Offline

Posted: Sun Jan 10, 2021 5:33 am
by apmuthu
In index.php file in both v4 and v4.5, we find a url to get the online version of Google Charts loader js file.

This does not bode well for those using NuBuilder applications in offline (non net) mode.

GitHub has a repo where Google Charts can be used offline:
https://github.com/changkejun/google-chart-offline

Stack Overflow has a nice discussion and workarounds for the same too at:
https://stackoverflow.com/questions/612 ... it-offline

Another developer has provided one for version 44 of Google Charts at:
https://www.dropbox.com/s/4cd7zbdvv2mlg ... c.zip?dl=0

Re: Google Charts Offline

Posted: Sun Jan 10, 2021 7:01 am
by kev1n
From https://developers.google.com/chart/int ... aldownload:

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 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 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.

Re: Google Charts Offline

Posted: Sun Jan 10, 2021 4:32 pm
by apmuthu
Hence we must clearly mention that nuBuilder cannot be used offline because of this Google TOS and that the workaround suggested can be used at one's own risk. The workaround can be explicitly stated here or a link to this post provided now that your commit has encapsulated it in a wrapper function. Do not know where else it may be used to justify wrapping it.

Better still, use another completely open source chart solution - google free.

Re: Google Charts Offline

Posted: Sun Jan 10, 2021 4:55 pm
by kev1n
nuBuilder can be used offline. Just set $nuConfigIncludeGoogleCharts = false in nuconfig.
And you might want to have a look at the Apex Charts (Include them with $nuConfigIncludeApexCharts = true). They can be used offline.