/* Load the data using Tabletop */
window.onload = function() {init()};
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);
}
};