Powered By Blogger

Monday, January 20, 2014

Dynamic Area Chart Jquery using google charts

<html><head>

<script type="text/javascript" src="https://www.google.com/jsapi"></script>
    <script type="text/javascript">
      google.load("visualization", "1", {packages:["corechart"]});
      google.setOnLoadCallback(drawChart);
      function drawChart() {
        var data = google.visualization.arrayToDataTable([
          ['Date', 'Order', 'Amounts'],
          ['1/1/14',  200,      400],
          ['2/1/14',  1170,      460],
          ['3/1/14',  660,       1120],
          ['4/1/14',  1030,      540]
        ]);

        var options = {
          title: 'Company Performance',
          hAxis: {title: 'Date',  titleTextStyle: {color: '#333'}},
          vAxis: {minValue: 0}
        };

        var chart = new google.visualization.AreaChart(document.getElementById('chart_div'));
        chart.draw(data, options);
      }
    </script>


</head>
<body>

<div id="chart_div" style="width: 900px; height: 500px;"></div>

</body>

Refence

https://google-developers.appspot.com/chart/interactive/docs/gallery/areachart      

Google Charts - All category of charts 

https://developers.google.com/chart/

No comments:

Post a Comment