How to make data points visible on line chart ?

17 views
Skip to first unread message

CJHLand

unread,
Mar 14, 2018, 6:46:07 PM3/14/18
to Google Visualization API
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()};


      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);
      }

      };
Reply all
Reply to author
Forward
0 new messages