以下代码显示堆积条形图。它适用于Chrome和Firefox。但是,IE不显示图表。我知道IE对额外的逗号和其他拼写错误非常敏感。我花了很多时间用IE开发人员工具查看这段代码,但我无法弄清楚为什么它没有显示。任何帮助将不胜感激。
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<title></title>
<meta name="" content="">
<meta name="vs_targetSchema" content="http://schemas.microsoft.com/intellisense/ie5">
<!-- CHARTS -->
<script type="text/javascript" src="https://www.google.com/jsapi"></script>
<script type="text/javascript">
google.load("visualization", "1", {packages:["corechart"]});
google.setOnLoadCallback(drawChart);
function drawChart() {
//================
//Historical tiers CHART
//================
var data_history = google.visualization.arrayToDataTable([
['Tiers', 'Baseline', 'Tier 2', 'Tier 3', 'Tier 4','Tier 5',
{ role: 'annotation' } ],
['1', 121, 18, 0, 0, 0, '138' ], ['2', 109, 31, 0, 0, 0, '140' ], ['3', 121, 18, 0, 0, 0, '138' ], ['4', 117, 37, 0, 0, 0, '154' ], ['5', 121, 18, 0, 0, 0, '138' ], ['6', 74, 25, 95, 0, 0, '194' ], ['7', 76, 26, 88, 0, 0, '190' ], ['8', 76, 26, 88, 0, 0, '190' ], ['9', 74, 25, 95, 0, 0, '194' ], ['10', 76, 26, 88, 0, 0, '190' ], ['11', 117, 22, 0, 0, 0, '139' ], ['12', 121, 18, 0, 0, 0, '138' ]
]);
var options = {
width: 800,
height: 300,
legend: { position: 'top', maxLines: 3 },
bar: { groupWidth: '75%' },
isStacked: true
};
var chart = new google.visualization.ColumnChart(document.getElementById('chart_historical'));
chart.draw(data_history, options);
}
</script>
<style>
.chart{
background-color:red;
}
</style>
</head>
<body>
<h1>chart</h1>
<div class=chart id="chart_historical" style="width: 850px; height: 340px;"></div>
</body>
</html>