I have looked through the google documentation and have tried a number of
things but can't for the life of me figure out how to make the datapoints
visible on this simple line chart. Your help would be appreciated. My
code is as follows:
Thanks
/* Load the data using Tabletop */
window.onload = function() {init()};
var publicSpreadsheetUrl =
'https://docs.google.com/spreadsheets/d/1TLLtM8DroPLEdB5_8sLNfi2_8Lq3P7CS8654LMSVNfU/edit?usp=sharing';
function init() {
Tabletop.init( { key: publicSpreadsheetUrl,
callback: showInfo,
simpleSheet: true } )
};
/* Draw the chart */
function showInfo(data, tabletop) {
google.charts.load('current', {'packages':['line', 'corechart']});
google.charts.setOnLoadCallback(drawChart);
function drawChart() {
var chart_data = new google.visualization.DataTable();
chart_data.addColumn('string', 'Year');
chart_data.addColumn('number', 'Ratio');
data.forEach(function(data){
array = [data.Year, Number(data.Ratio)];
chart_data.addRow(array);
console.log(array);
});
var options = {'width':900,'height':450, series: {0: {axis:
'Ratio'}}, axes: {y: {Ratio: {label: 'Debt to GDP Ratio'}}}
};
var chart = new
google.charts.Line(document.getElementById("line_chart"));
chart.draw(chart_data, options);
}
};
--
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 https://groups.google.com/group/google-visualization-api.
To view this discussion on the web visit
https://groups.google.com/d/msgid/google-visualization-api/2777d6a5-fe4f-465e-9782-329e9e6021c9%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.