Here's the code I use.  Not sure if this is what you're looking for:

<script src="https://www.google.com/jsapi";></script>
<script 
src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js";></script>
<script type="text/javascript">
  google.load('visualization', '1.0', {'packages':['corechart']});
  google.setOnLoadCallback(drawChart);
  function drawChart () {
      $.ajax({
          url: 'output.txt',
          type: 'get',
          success: function (txt) {
              var dataArray = [['Date', 'Price']];
              var txtArray = txt.split('\n');
              for (var i = 0; i < txtArray.length; i++) {
                  var tmpData = txtArray[i].split(/,/);
                  dataArray.push([tmpData[0], parseInt(tmpData[1])]);
              }
              var data = google.visualization.arrayToDataTable(dataArray);
              var chart = new 
google.visualization.LineChart(document.querySelector('#chart_div'));
              var options = {
title: 'Value of this Car',
width: 430,
height: 252,
vAxis: { format:'$####'}
};
              chart.draw(data,options);
          }
      });
  }
  google.load('visualization', '1', {packages:['corechart'], callback: 
drawChart});
</script>

The text file I use (output.txt):

Jan 2016,940
Apr 2016,940
Jul 2016,950
Oct 2016,950
Jan 2017,975 
Apr 2017,977 
Jul 2017,1045 
Oct 2017,1115 
Jan 2018,1115 
Apr 2018,1123

Hope this helps.

Scott

-- 
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/df2565a6-6fb8-402f-a14f-d17eccfc9eae%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to