Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Google Charts: Line Chart: Doesn't display in IE and Firefox, but works in chrome

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>
like image 578
XenoPuTtSs Avatar asked Mar 29 '12 12:03

XenoPuTtSs


1 Answers

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. :)

like image 184
Apurv Gupta Avatar answered Oct 20 '22 07:10

Apurv Gupta