Advertisement
Guest User

Untitled

a guest
Oct 22nd, 2014
132
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.07 KB | None | 0 0
  1. // Set a callback to run when the Google Visualization API is loaded.
  2. google.setOnLoadCallback(drawChart);
  3.  
  4. // Callback that creates and populates a data table,
  5. // instantiates the pie chart, passes in the data and
  6. // draws it.
  7. function drawChart() {
  8.  
  9. // Create the data table.
  10. var data = new google.visualization.DataTable();
  11. data.addColumn('string', 'Topping');
  12. data.addColumn('number', 'Slices');
  13. data.addRows([
  14. ['Mushrooms', 3],
  15. ['Onions', 1],
  16. ['Olives', 1],
  17. ['Zucchini', 1],
  18. ['Pepperoni', 2]
  19. ]);
  20.  
  21. // Set chart options
  22. var options = {'title':'How Much Pizza I Ate Last Night',
  23. 'width':400,
  24. 'height':300};
  25.  
  26. // Instantiate and draw our chart, passing in some options.
  27. var chart = new google.visualization.PieChart(document.getElementById('chart_div'));
  28. chart.draw(data, options);
  29. }
  30. </script>
  31. <div id="chart_div"></div>
  32. </div>
  33. </div>
  34. </body>
  35. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement