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.