[Solved] Google Chart- HTML element does not appearing

Hello,

Im trying to create basic chart , using Google Chart embedded in the HTML element. But from what ever reason its doesn’t appear in the preview. (Although if im using JSfiddle it does work)

The code is very basic code:(and based on template i found at the forum)

<html>
  <head>
    <script type="text/javascript">
	   var results = [];
	   var x = [5,7,8];
	   var y = [3,6,7];

results.push (['labelx', 'label y']);


		for (i = 0; i < x.length; i++) {
			results.push([parseInt(x[i]),parseInt(y[i])]);
		}

      google.charts.load('current', {'packages':['corechart']});
      google.charts.setOnLoadCallback(drawChart);
      function drawChart() {
        var data = google.visualization.arrayToDataTable(results);

        var options = {
          title: 'test',
	  curveType: 'function',
	  hAxis:{title:'date'},
	  vAxis:{title:20,minValue:0},
                       };

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

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

link to the application

Any help will be highly appricated

1 Like

I added some missing code to your page header to load the chart.

<script type="text/javascript" src="https://www.gstatic.com/charts/loader.js"></script>
    <script type="text/javascript">

Great Thanks highly appreciated !!! :slight_smile:

This topic was automatically closed after 70 days. New replies are no longer allowed.