Advertisement
Guest User

Untitled

a guest
Jan 17th, 2019
120
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.46 KB | None | 0 0
  1. <html>
  2. <head>
  3. <!--Load the AJAX API-->
  4. <script type="text/javascript" src="https://www.gstatic.com/charts/loader.js"></script>
  5. <script type="text/javascript">
  6.  
  7. // Load the Visualization API and the corechart package.
  8. google.charts.load('current', {'packages':['corechart']});
  9.  
  10. // Set a callback to run when the Google Visualization API is loaded.
  11. google.charts.setOnLoadCallback(drawChart);
  12.  
  13. // Callback that creates and populates a data table,
  14. // instantiates the pie chart, passes in the data and
  15. // draws it.
  16. function drawChart() {
  17.  
  18. // Create the data table.
  19. var data = new google.visualization.DataTable();
  20. data.addColumn('string', 'Topping');
  21. data.addColumn('number', 'Slices');
  22. data.addRows([
  23. ['Mushrooms', 3],
  24. ['Onions', 1],
  25. ['Olives', 1],
  26. ['Zucchini', 1],
  27. ['Pepperoni', 2]
  28. ]);
  29.  
  30. // Set chart options
  31. var options = {'title':'How Much Pizza I Ate Last Night',
  32. 'width':400,
  33. 'height':300};
  34.  
  35. // Instantiate and draw our chart, passing in some options.
  36. var chart = new google.visualization.PieChart(document.getElementById('chart_div'));
  37. chart.draw(data, options);
  38. }
  39. </script>
  40. </head>
  41.  
  42. <body>
  43. <!--Div that will hold the pie chart-->
  44. <div id="chart_div"></div>
  45. </body>
  46. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement