Add JSON to google charts

15 views
Skip to first unread message

eran greenberg

unread,
Jun 20, 2017, 3:56:31 PM6/20/17
to Google Visualization API
That should be easy ...

i want to use google line chart 
  <html>
 
<head>
   
<script type="text/javascript" src="https://www.gstatic.com/charts/loader.js"></script>
   
<script type="text/javascript">
      google
.charts.load('current', {'packages':['corechart']});
      google
.charts.setOnLoadCallback(drawChart);

     
function drawChart() {
       
var data = google.visualization.arrayToDataTable([
         
['Year', 'Sales'],
         
['2004',  1000],
         
['2005',  1170],
         
['2006',  660],
         
['2007',  1030]
       
]);

       
var options = {
          title
: 'Company Performance',
          curveType
: 'function',
          legend
: { position: 'bottom' }
       
};

       
var chart = new google.visualization.LineChart(document.getElementById('curve_chart'));

        chart
.draw(data, options);
     
}
   
</script>
 
</head>
 
<body>
   
<div id="curve_chart" style="width: 900px; height: 500px"></div>
 
</body>
</html>


and to use data im getting from


X axes should be "time"
y axes should be "close"



Reply all
Reply to author
Forward
0 new messages