Why do you want to use a range if data is going to be added? The range will always pull data from those cells, regardless of whether there is any data in them, or whether there is more data to be found elsewhere.
As far as your code goes, you have a syntax error: there is an extra });after the chart.draw call. I fixed the error and set the query to pull from the range A1:E35, and it works: http://jsfiddle.net/asgallant/3neQw/ On Tuesday, March 25, 2014 12:43:32 PM UTC-4, Dave Lalande wrote: > > Here is my complete HTML/Javascript: It's not working... I'm trying to > do things "by the > book".<https://developers.google.com/chart/interactive/docs/spreadsheets#queryurlformat> > > <html> > > <head> > <meta charset="utf-8"> > <meta http-equiv="X-UA-Compatible" content="IE=edge"> > <!--<script type="text/javascript" src=" > http://code.jquery.com/jquery-latest.min.js"></script> > <script type="text/javascript">--> > > > <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 query = new google.visualization.Query(' > https://spreadsheets.google.com/spreadsheet/tq?range=A19:E35&key=0AhCv9Xu_eRnSdHBELWZoZHRaQTl5VXdRa3JLTzByUlE&gid=2' > ); > > 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.LineChart(document.querySelector('#chart_div')); > chart.draw(data, { > //chartArea: {width: '70%', height: '50%'}, > fontName: ["Arial"], > colors:['#20413A','#ff6600','#0000ff','#ff0000'], > curveType: ['none'], > fontSize: ['11'], > hAxis: {title: 'Metric A Name', titleTextStyle: {italic: > false, color: 'black', fontSize: 12}}, > legend: {position: 'right', textStyle: {color: 'black', > fontSize: 12}}, > lineWidth: 2, > pointSize: 7, > tooltip: {textStyle: {color: 'Black'}, showColorCode: false} > }); > }); > } > > </script> > > <title>LineChart - Google Sheet as Data Source</title> > </head> > > <body> > <div id="chart_div" style="width: 960px; height: 500px;"></div> > </body> > > </html> > > I know there are cells in this range that are blank but I'm attempting to > setup a situation where as more data is added to the sheet the chart > redraws with the additional data. I've tried a range A1:A6 that has > complete data and this page still doesn't work. hmmmm... > -- 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. For more options, visit https://groups.google.com/d/optout.
