Web Programming examples

Google Maps,AngularJS

Google Chart Quick Start

Basic example
<script type='text/javascript' src='https://www.google.com/jsapi'></script>
<script type='text/javascript' src='http://www.example.com/wp/wp-content/themes/ang/js/script.js'></script>
<div id="chart_div"></div>
google.load('visualization', '1.0', {'packages':['corechart']});
google.setOnLoadCallback(drawChart);
function drawChart() {
  var data = new google.visualization.DataTable();
  data.addColumn('string', 'Topping');
  data.addColumn('number', 'Slices');
  data.addRows([
    ['Mushrooms', 3],
    ['Onions', 1],
    ['Olives', 1],
    ['Zucchini', 1],
    ['Pepperoni', 2]
  ]);
  var options = {'title':'How Much Pizza I Ate Last Night',
                 'width':400,
                 'height':300};

  var chart = new google.visualization.PieChart(document.getElementById('chart_d
iv'));
  chart.draw(data, options);
}

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.