Can we use Google Chart Tools with Google Script HtmlService

血红的双手。 提交于 2019-12-21 21:46:40

问题


I would like to use Google Chart Tools in Google Scripts using the HtmlService. But I do not know if caja will allow to inject script to show a chart. My first tests give me blank pages.

Does anyone know if it is at least possible ?

I know Google Script provides 'Charts' service, but the features are limited compared to what allows Google Chart Tools.

Thanks,


回答1:


If you look at the HtmlService documentation under the Caja section, https://developers.google.com/apps-script/html_service#Caja it says that included libraries are sanitized and so far only JQuery is supported.

Since Chart Tools depend on Google's jsapi, and it appears to do some pretty funky magic, I'd bet it won't pass Caja sanitization right now.

I wonder if there's some way to use the GAS Charts library to produce the charts (albeit statics ones)? But it produces blobs and I'm not sure how to integrate those into the HtmlService's page?!




回答2:


Charts are not supported just yet.




回答3:


I had used the Google Chart Tools before the Charts service was introduced. At the fundamental level, Google Chart Tools returns an image of the chart you wish and the data is passed to it via URL parameters.

Using general Javascript, I had developed the logic to build a URL and then get the image using UrlFetchApp and then display it on an Apps Script using UiApp.createImage().

If you can post some code, you could receive more help




回答4:


This is now possible, sometime over the last 3 months or so.



来源:https://stackoverflow.com/questions/11231535/can-we-use-google-chart-tools-with-google-script-htmlservice

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!