grafana-sankey-panel icon indicating copy to clipboard operation
grafana-sankey-panel copied to clipboard

How not to build plugin with google chart

Open throrin19 opened this issue 5 years ago • 6 comments

Hi,

Your project is really cool but I have a good suggestion. Why you don't build your js plugin with directly the google charts loader inside it ? It's more simple to include your plugin into our grafana server using this and, in that case, we don't have to modify the index.html file

Thanks

throrin19 avatar Nov 22 '18 08:11 throrin19

@throrin19 I will try it with the suggested way

kumaravel29 avatar Dec 09 '18 10:12 kumaravel29

@kumaravel29 That would be great if it was self-contained when you release the 6.x compatible version.

bhozar avatar Nov 21 '19 22:11 bhozar

Tried including the google charts in the plugin itself. But the Sankey chart does not seems to be available with the function. Any suggestions/links related to this would be appreciated.

kumaravel29 avatar Jan 03 '20 16:01 kumaravel29

Not sure you can:

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

From: https://developers.google.com/chart/interactive/faq

bhozar avatar Jan 04 '20 11:01 bhozar

Perhaps ask Grafana Devs if you can include it in some other way?

bhozar avatar Jan 04 '20 11:01 bhozar

Looks like some other plugin's use externaly hosted .js files too. Search for MathJax.js in this file to see the imported src URL: https://github.com/algenty/grafana-flowcharting/blob/master/src/libs/viewer.min.js

Looks like this in the browser: <script type="text/javascript" src="https://www.draw.io/math/MathJax.js?config=TeX-MML-AM_HTMLorMML"></script>

bhozar avatar Jan 06 '20 18:01 bhozar