Google Stack column chart works fine with Chrome but doesnt work with IE8 -
i looked out solution problem couldnt find solution.
i have code work fine chrome , firefox, throws error "expected identifier, string or number" ie8
<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 = google.visualization.arraytodatatable([ ['genre', 'fantasy & sci fi', 'romance', 'mystery/crime', 'general', 'western', 'literature', { role: 'annotation' } ], ['2010', 10, 24, 20, 32, 18, 5, ''], ['2020', 16, 22, 23, 30, 16, 9, ''], ['2030', 28, 19, 29, 30, 12, 13, ''], ]); var options = { width: 600, height: 400, legend: { position: 'top', maxlines: 3 }, bar: { groupwidth: '75%' }, isstacked: true, }; var chart = new google.visualization.columnchart(document.getelementbyid('chart_div')); chart.draw(data, options); } </script> </head> <body> <div id="chart_div" style="width: 900px; height: 500px;"></div> </body> </html>
you have errant commas causing problem:
var data = google.visualization.arraytodatatable([ ['genre', 'fantasy & sci fi', 'romance', 'mystery/crime', 'general', 'western', 'literature', { role: 'annotation' } ], ['2010', 10, 24, 20, 32, 18, 5, ''], ['2020', 16, 22, 23, 30, 16, 9, ''], ['2030', 28, 19, 29, 30, 12, 13, ''], // <-- comma should go away ]); var options = { width: 600, height: 400, legend: { position: 'top', maxlines: 3 }, bar: { groupwidth: '75%' }, isstacked: true, // <-- , comma };
ie throw temper tantrum rival petulant 2-year-old child when presented comma @ end of array or object.
Comments
Post a Comment