Guest User

Untitled

a guest
Jan 15th, 2019
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.82 KB | None | 0 0
  1. function drawVisualization() {
  2. // Create and populate the data table.
  3. var data = google.visualization.arrayToDataTable([
  4. ['Task', 'Hours per Day'],
  5. ['Work', 11],
  6. ['Eat', 2],
  7. ['Commute', 2],
  8. ['Watch TV', 2],
  9. ['Sleep', 7]
  10. ]);
  11.  
  12. // Create and draw the visualization.
  13. var chart = new google.visualization.PieChart(document.getElementById('visualization'));
  14. google.visualization.events.addListener(chart, 'ready', allReady); // ADD LISTENER
  15. chart.draw(data, {title:"So, how was your day?"});
  16. }
  17.  
  18. function allReady() {
  19. var e = document.getElementById('visualization');
  20. // svg elements don't have inner/outerHTML properties, so use the parents
  21. alert(e.getElementsByTagName('svg')[0].parentNode.innerHTML);
  22. }
  23.  
  24. google.setOnLoadCallback(drawVisualization);
Add Comment
Please, Sign In to add comment