我刚刚开始使用 HTML5 和 JQuery。我将在导航栏的弹出框内显示 Google 柱形图。我有以下代码,但它没有显示弹出框内的图表。有人可以帮我解决这个问题吗?谢谢。
<a id="electricity" class="action" rel="popover">Elpriser</a>
<script>
$("#electricity")
.popover(
{ placement : 'top', html : true,
content : '<div class="popover-content-el"><div class="lable-electricity"><h3>Nordpool</h3></div><div id="chart_div" style="width: 300px; height: 200px;"></div></div>'
});
</script>
<script type="text/javascript">
google.load("visualization", "1", {
packages : [ "corechart" ]
});
google.setOnLoadCallback(drawChart);
function drawChart() {
var data = google.visualization.arrayToDataTable([
[ 'SE1', 'Idag', 'Imorgon' ], [ 'SE1', 1170, 460 ],
[ 'SE2', 1170, 460 ], [ 'SE3', 660, 1120 ],
[ 'SE4', 1030, 540 ] ]);
var options = {
vAxis : {
textPosition : 'none',
gridlines : {
color : "#ffffff"
}
},
};
var chart = new google.visualization.ColumnChart(document
.getElementById('chart_div'));
chart.draw(data, options);
}
</script>