我想将 appscript htmlservice 与 appscript 一起使用,html 服务似乎工作但可视化不起作用。这是供参考的代码。代码.GS:
// Script-as-app template.
function doGet() {
return HtmlService.createHtmlOutputFromFile('html_visualization');
}
html_visualization.html
<html>
<head>
<script type="text/javascript" src="https://www.google.com/jsapi"></script>
<script type="text/javascript">
google.load('visualization', '1.0', {'packages':['corechart']});
google.setOnLoadCallback(drawChart);
function drawChart() {
var data = new google.visualization.DataTable();
data.addColumn('string', 'Topping');
data.addColumn('number', 'Slices');
data.addRows([
['Mushrooms', 3],
['Onions', 1],
['Olives', 1],
['Zucchini', 1],
['Pepperoni', 2]
]);
var options = {'title':'How Much Pizza I Ate Last Night','width':400, 'height':300};
var chart = new google.visualization.PieChart(document.getElementById ('chart_div') );
chart.draw(data, options);
}
</script>
</head>
<body>
<div id="chart_div"></div>
Hello World
</body>
</html>
发布时出现 Hello world 但没有图表迹象。