Hi Sekhar, The Query is primarily for loading JSON data. It can load CSV, but this functionality is currently undocumented. There was a thread a while ago where I explained how to use Query with a CSV file. You may find it here <https://groups.google.com/d/msg/google-visualization-api/8Ussi3X1fdA/TCxIoiXXliQJ> .
On Sat, Nov 28, 2015 at 7:58 PM Sekhar Krishna Kondisetty < [email protected]> wrote: > 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 > <https://groups.google.com/d/msgid/google-visualization-api/be176b4b-158a-4494-9b1c-69ae3fef058c%40googlegroups.com?utm_medium=email&utm_source=footer> > . > For more options, visit https://groups.google.com/d/optout. > -- [image: unnamed.gif] • • • • Sergey Grabkovsky Software Engineer Google, Inc [email protected] -- 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/CAEwwup7i9H_kWhv6Q6Eoftud1wdOseCkcyxO7NFVex3mbz27nw%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
