Hi, I just started using google visualisation and I am trying to pull data from csv file and populate it in a bar chart. I am not able to see the bars in the bar chart. Can someone please help me as soon as possible.
This is the CSV Year,Sale,Expenses 2005,1000,1000 2006,1002,1002 2007,12,23 This is the code... <!DOCTYPE html> <html> <head> <title>All Examples</title> <!--Load the AJAX API--> <script type="text/javascript" src="http://www.google.com/jsapi"></ script> <script type="text/javascript"> // Load the Visualization API and the ready-made Google table visualization. google.load('visualization', '1', {'packages': ['table,piechart,orgchart,barchart,annotatedtimeline']}); // Set a callback to run when the API is loaded. google.setOnLoadCallback(init); // Send the queries to the data sources. function init() { var cpuQ = new google.visualization.Query('csv?url=http:// localhost:8080/example/Ovicom_subscriptions.csv'); cpuQ.send(cpu); } // Handle the csv data source query response function handleCsvDsResponse(response) { if (response.isError()) { alert('Error in query: ' + response.getMessage() + ' ' + response.getDetailedMessage()); return; } var data = response.getDataTable(); var chart = new google.visualization.OrgChart (document.getElementById('csv_div')); chart.draw(data, {width: 600, height: 150, is3D: true}); } function cpu(response) { if (response.isError()) { alert('Error in query: ' + response.getMessage() + ' ' + response.getDetailedMessage()); return; } var data = response.getDataTable(); var chart = new google.visualization.BarChart (document.getElementById('cpu')); chart.draw(data, null); } </script> </head> <body> <h1> CSV Data Source </h1> <div id="csv_div" style="width: 400px"></div> <h1> CSV Data Source </h1> <div id="cpu" style='width: 440px; height: 300px;'></div> </body> </html> -- 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.
