Hi All -
I am new to Google Development and want to build a dashboard for my
business using Google Charts. Hence i started exploring this. As part of
this, i am trying to build a code to generate a graph using a CSV. For this
i have installed IIS on my laptop and find the details below.
IIS Location: C:\inetpub\wwwroot
CSV Location: C:\inetput\wwwroot\MySite
CSV Details: It is a simple CSV and here are those details.
1,300
2,400
3,699
4,876
Code:
<html>
<head>
<!--Load the AJAX API-->
<script type="text/javascript"
src="https://www.google.com/jsapi"></script>
<script type="text/javascript">
// Load the Visualization API and the piechart package.
google.load('visualization', '1.0', {'packages':['corechart']});
// Set a callback to run when the Google Visualization API is loaded.
google.setOnLoadCallback(initialize);
// Callback that creates and populates a data table,
// instantiates the pie chart, passes in the data and
// draws it.
function initialize() {
var opts = {sendMethod: 'auto'};
// Replace the data source URL on next line with your data source URL.
var query = new
google.visualization.Query('http://localhost/MySite/data.csv');
// Optional request to return only column C and the sum of column B,
grouped by C members.
query.setQuery('select A, B');
// Send the query with a callback function.
query.send(handleQueryResponse);
}
function handleQueryResponse(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('chart_div'));
chart.draw(data, {width: 400, height: 240, is3D: true});
}
</script>
</head>
<body>
<!--Div that will hold the pie chart-->
<div id="chart_div"></div>
</body>
</html>
Could you please help me in understanding the issue? This is not generating
any output.
Thanks.
--
You received this message because you are subscribed to the Google Groups
"Google Visualization API" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/google-visualization-api.
To view this discussion on the web visit
https://groups.google.com/d/msgid/google-visualization-api/be176b4b-158a-4494-9b1c-69ae3fef058c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.