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,
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?!
Charts are not supported just yet.
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
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