This works well <html> <head> <script type="text/javascript" src="http://www.google.com/jsapi"></script> <script type="text/javascript"> google.load('visualization', '1', {packages: ['table','columnchart']}); function drawVisualization() { // Create and populate the data table. var JSONObject = { cols: [ {id: 'ActivityDate', label:'ActivityDate', type: 'string'}, {id: 'Count', label: 'Count', type:'number'} ], rows: [ {c: [{v: 'DateA'},{v:130}]}, // here you should give NUMBER but NOT string {c: [{v: 'DateB'},{v:255}]}, {c: [{v: 'DateC'},{v:380}]} ] }; var data = new google.visualization.DataTable(JSONObject); // Create and draw the visualization. var visualization = new google.visualization.Table(document.getElementById('table')); visualization.draw(data, {}); // empty options == "{}" don't better use null. // Create and draw the visualization. new google.visualization.ColumnChart(document.getElementById('chart_div')).draw(data, {width: 300, height: 200}); } google.setOnLoadCallback(drawVisualization); </script> </head> <body> <div id="table"></div> <div id="chart_div"></div> </body> </html>
2009/4/7 Ned <[email protected]> > > I'm trying to output the following data to the screen as both a table > and a chart. When I try this, I get the table fine, but the Chart > appears without any bars (the y-axis goes from 0 to 1 without any bars > in the graph). Is there something I'm doing wrong when trying to > output the chart? > > <script type="text/javascript" src="http://www.google.com/jsapi"></ > script> > <script type="text/javascript"> > google.load('visualization', '1', {packages: ['table']}); > google.load('visualization', '1', {packages: ['columnchart']}); > </script> > <script type="text/javascript"> > function drawVisualization() { > // Create and populate the data table. > var JSONObject = {cols: [{id: 'ActivityDate', label: > 'ActivityDate', type: 'string'},{id: 'Count', label: 'Count', type: > 'number'}], rows: [{c: [{v: 'DateA'},{v: '130'}]},{c: [{v: 'DateB'}, > {v: '255'}]},{c: [{v: 'DateC'},{v: '380'}]}]}; > > > var data = new google.visualization.DataTable(JSONObject); > > // Create and draw the visualization. > visualization = new google.visualization.Table > (document.getElementById('table')); > visualization.draw(data, null); > > > // Create and draw the visualization. > new google.visualization.ColumnChart(document.getElementById > ('chart_div')). > draw(data, null); > > } > > > google.setOnLoadCallback(drawVisualization); > </script> > > > Thanks! > > > > -- С уважением, Максим Барбул --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Google Visualization API" group. 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 -~----------~----~----~----~------~----~------~--~---
