Google可视化“未绘制图表”

时间:2014-08-18 18:41:34

标签: google-visualization

我有一个绘制脚本。它似乎以前工作,但我不得不重新配置一些东西。我将创建它的代码与旧版本进行了比较,并将脚本与我为创建柱形图创建的类似脚本进行了比较。它们似乎都排成一列,但这个版本没有渲染。我在Chrome开发者标签中获得以下内容:

format+en_GB,default+en_GB,ui+en_GB,corechart+en_GB.I.js:1269

渲染脚本:

<div id="chart_div1"></div>
<div id="png"></div>
<script>
google.load("visualization", "1", {packages:["corechart"]});
google.setOnLoadCallback(drawChart);
function drawChart() {
var dt = new google.visualization.DataTable({cols:[{id:'activity',label:'Activity',type:'string'},{id:'size',label:'size',type:'number'},{id:'compositeutility',label:'compositeutility',type:'number'}],rows:[{c:[{v:'AH32HH2050_3p'},{v:220325.0},{v:220974.256897}]}]}, 0.6);
var chart = new google.visualization.ColumnChart(document.getElementById('chart_div1'));

var actOrCom = ""
    if (actOrCom=="activity"){
         chart.draw(dt, { width: 800, height: 250, hAxis: {title: 'Activity', titleTextStyle: {color: 'red'}}, series:{0:{targetAxisIndex:0},1:{targetAxisIndex:1}}, vAxes:{0:{title:"size"},1:{title:"compositeutility", titleTextStyle: {color: 'red'}}}
    });
    }
    else if (actOrCom=="commodity"){
        chart.draw(dt, { width: 800, height: 250, hAxis: {title: 'Commodity', titleTextStyle: {color: 'red'}}, series:{0:{targetAxisIndex:0},1:{targetAxisIndex:1}}, vAxes:{0:{title:"size"},1:{title:"compositeutility", titleTextStyle: {color: 'red'}}}
    });
    }
document.getElementById('png').outerHTML = '<a href="' + chart.getImageURI() + '">Printable Version</a>';
}
</script>

0 个答案:

没有答案