Google line Chart creation - Javascript Google Chart

Javascript examples for Google Chart:Line Chart

Description

Google line Chart creation

Demo Code

ResultView the demo in separate window

<html>
   <head> 
      <title>Google chart solution stackOverflow</title> 
      <meta name="viewport" content="width=device-width, initial-scale=1"> 
      <script type="text/javascript" src="https://www.google.com/jsapi?autoload={'modules':[{'name':'visualization','version':'1','packages':['corechart'],'language':'ru'}]}"></script> 
      <script type="text/javascript">
    window.onload=function(){//from  www. jav  a2s  .c om
var p1        = parseInt('4'),
    ch_period = {'17':4};
function drawChart() {
    var data = new google.visualization.DataTable();
    data.addColumn('number', 'Topping');
    data.addColumn('number', 'Slices');
    data.addRows([
        [p1, 1.89],
        [ch_period[17], 5],
        [3, 2],
        [5, 2],
        [5, 2],
        [6, 7]
    ]);
    var options = {
        'title': 'How Much Pizza I Ate Last Night',
            'width': 400,
            'height': 300
    };
    var chart = new google.visualization.LineChart(document.getElementById('chart_div'));
    chart.draw(data, options);
}
drawChart();
    }

      </script> 
   </head> 
   <body> 
      <div id="chart_div"></div>  
   </body>
</html>

Related Tutorials