Line Chart Example

An example of a Google Line Chart.

by Kamal Kumawat

HTML

<script type="text/javascript" src="https://www.google.com/jsapi?autoload={'modules':[{'name':'visualization','version':'1','packages':['corechart']}]}"></script>
       <div id="chart_div" style="width: 900px; height: 500px;"></div>

JavaScript

google.setOnLoadCallback(drawChart);
      function drawChart() {
        var data = google.visualization.arrayToDataTable([
          ['Year', 'Max score (100%)', 'MOL Group Total score', 'Best score', 'Industry average', 'Threshold'],
          ['2007',  100, 63, 77, 53, 68 ],
          ['2008',  100, 65, 80, 49, 68 ],
          ['2009',  100, 68, 82, 49, 69 ],
          ['2010',  100, 75, 77, 49, 70 ],
            ['2011', 100, 68, 86, 51, 68 ],
            ['2012', 100, 69, 85, 53, 72 ],
            ['2013', 100, 66, 83, 48, 69 ],
            ['2014', 100, 68, 87, 49, 68 ]
        ]);

        var options = {
          title: 'DJSI performance of MOL Group'
        };

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

        chart.draw(data, options);
      }