Word Tree Example

My Love as a Google Word Tree.

by janetyc

HTML

<script type="text/javascript" src="https://www.google.com/jsapi?autoload={'modules':[{'name':'visualization','version':'1','packages':['wordtree']}]}"></script>
<div id="wordtree_basic" style="width: 900px; height: 500px;"></div>

JavaScript

google.setOnLoadCallback(drawChart);

      function drawChart() {
          var data = google.visualization.arrayToDataTable(
          [
              ['Phrases'],
              ['My love is like...whoa'],
              ['My love is like...whoa'],
              ['My love is like a red, red rose That’s newly sprung in June'],
              ['My love is like the melody That’s sweetly played in tune'],
              ['My love is like an ocean It goes down so deep'],
              ['My love is like a rose Whose beauty you want to keep'],
              ['My love is like a river That will never end'],
              ['My love is like a dove With a beautiful message to send'],
              ['My love is like a song That goes on and on forever'],
              ['My love is like a prisoner tis to you that I surrender'],
              ['My love is a smoke made with the fume of sighs'],
              ['My love Love is the crowning grace of humanity, the holiest right of the soul, the golden link which binds us to duty and truth, the redeeming principle that chiefly reconciles the heart to life, and is prophetic of eternal good'],
              ['My love is the only sane and satisfactory answer to the problem of human existence'],
              ['My Love Is Like A Star, yeah'],
              ['My love is like to ice, and I to fire'],
              ['My love is like the sun That in the firmament does run'],
              ['My Love Is like air, sometimes silent but always around you'], ]);

          var options = {
              wordtree: {
                  format: 'implicit',
                  word: 'cats'
              }
          };

          var chart = new google.visualization.WordTree(document.getElementById('wordtree_basic'));
          chart.draw(data, options);
      }