Your data.addRow(...) statements are missing the closing "]" at the end, ie:

data.addRow(['0h', 5347);

should be:

data.addRow(['0h', 5347]);

Also, you need to pass the DOM element object for the container div to the 
chart constructor, not the id of the container div, so this:

var chart = new google.visualization.BarChart('chart_div');

should be this:

var chart = new google.visualization.BarChart(document.getElementById(
'chart_div'));

Make those fixes and it should work (see example here: 
http://jsfiddle.net/asgallant/mTnk8/).

On Wednesday, September 26, 2012 5:05:40 AM UTC-4, thecatz wrote:
>
> <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('string', 
> 'heures');    data.addColumn('number', 'metric');    data.addRow(['0h', 
> 5347);data.addRow(['1h', 3121);data.addRow(['2h', 2362);data.addRow(['3h', 
> 1591);data.addRow(['4h', 1692);data.addRow(['5h', 2206);data.addRow(['6h', 
> 4684);data.addRow(['7h', 10821);data.addRow(['8h', 19478);data.addRow(['9h', 
> 22051);                 var options = {          title: 'test',          
> hAxis: {title: 'heures',  titleTextStyle: {color: 'red'}}        };           
>    var chart = new google.visualization.BarChart('chart_div');     
> chart.draw(data, options);}</script>  </head>  <body>   <div id="chart_div" 
> style="width: 900px; height: 500px;"></div>  </body></html>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Google Visualization API" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/google-visualization-api/-/mjczCmTO32UJ.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-visualization-api?hl=en.

Reply via email to