-1

I want to get WordTree created from Google sheets URL as a data source

The wordTree chart is at: https://developers.google.com/chart/interactive/docs/gallery/wordtree

and changing Datasource can be found https://developers.google.com/chart/interactive/docs/drawing_charts

However I'm keep getting errors and can't grab the sheet and code doesn't run

WhiteHat
  • 59,912
  • 7
  • 51
  • 133
  • Looking to replace this section: function drawChart() { var data = google.visualization.arrayToDataTable( [ ['Phrases'], ['cats are better than dogs'], ['cats eat kibble'], ['cats are better than hamsters'], ['cats are better than kittens'], ['cats are evil'], ['cats are weird'], ['cats eat mice'], ] ); to a line that takes the data from google sheets instead https://docs.google.com/spreadsheets/d/1loB8SHnERMVCyjaWWkWi-ADmA99Yjf4FrgGD-oPUPdA/edit?usp=sharing – sunshine1702 Jul 14 '21 at 05:11

1 Answers1

0

seems to work with the chart wrapper class...

google.charts.load('current', {
  packages: ['wordtree']
}).then(function () {
  var chart = new google.visualization.ChartWrapper({
    chartType: 'WordTree',
    containerId: 'chart',
    dataSourceUrl: 'https://docs.google.com/spreadsheets/d/1loB8SHnERMVCyjaWWkWi-ADmA99Yjf4FrgGD-oPUPdA/edit?usp=sharing',
    query: 'SELECT A,B',
    options: {
      wordtree: {
        format: 'implicit',
        word: 'patio'
      }
    }
  });
  chart.draw();
});

be sure the query property is set to pull the columns with data.

see following fiddle...
https://jsfiddle.net/WhiteHat/L0vmk2tq/

WhiteHat
  • 59,912
  • 7
  • 51
  • 133