Reputation: 1284
I have a simple chart (albeit with a lot of data) that renders fine in chrome but doesn't render in IE or Firefox. Since I don't know much about web development I do not know how to figure out what is going wrong.
Can someone help me figure out what is wrong, and perhaps explain how they figured it out?
<html>
<head>
<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() {
var data = new google.visualization.DataTable();
data.addColumn('datetime', 'Time');
data.addColumn('number', 'Amelias Room');
data.addColumn('number', 'board1');
data.addColumn('number', 'board2');
data.addColumn('number', 'Emersons Room');
data.addRows([
[new Date('2012-03-27 08:25:00'), 73,67,67,71],
[new Date('2012-03-27 08:26:00'), 73,67,67,71],
[new Date('2012-03-27 08:27:00'), 73,67,67,71],
[new Date('2012-03-27 08:28:00'), 74,67,67,71],
[new Date('2012-03-27 08:29:00'), 74,67,67,71],
[new Date('2012-03-27 08:30:00'), 75,67,67,71],
[new Date('2012-03-27 08:31:00'), 75,67,67,71],
[new Date('2012-03-27 08:32:00'), 74,67,67,71],
[new Date('2012-03-27 08:33:00'), 74,67,67,71],
[new Date('2012-03-27 08:34:00'), 73,67,67,71],
[new Date('2012-03-29 08:19:00'), 70.2244318181818,68.39375,67.8772727272728,71.0528409090909],
[new Date('2012-03-29 08:20:00'), 70.1732954545455,68.45,67.8777173913044,71.0323863636363],
[new Date('2012-03-29 08:21:00'), 70.1426136363637,68.4448863636364,67.83125,70.9607954545454],
[new Date('2012-03-29 08:22:00'), 70.1375,68.3426136363637,67.775,70.9352272727273]
]);
var options = {
title: 'Temp Readings'
};
var chart = new google.visualization.LineChart(document.getElementById('chart_div'));
chart.draw(data, options);
}
</script>
</head>
<body>
<div id="chart_div" style="width: 1024px; height: 768px;"></div>
</body>
</html>
Upvotes: 8
Views: 6860
Reputation: 860
Try changing "-" to "/"
e.g. [new Date('2012-03-27 08:25:00'), 73,67,67,71]
to
[new Date('2012/03/27 08:25:00'), 73,67,67,71]
working on my IE9. :)
Upvotes: 10
Reputation: 20620
From the documentation: Warning: You cannot load both linechart and corechart packages at the same time on the same page.
So use this line: google.load("visualization", "1", {packages:["linechart"]});
Here's a working jsFiddle:
http://jsfiddle.net/Steve_Wellens/X3UsB/
Upvotes: 0