Google 图表树图是否支持 angular-google-图表?

Is Google Charts tree map supported in angular-google-chart?

我正在使用 angular-google-图表作为 MEAN 堆栈的一部分。我想添加一个 Google 图表树状图,但页面上没有任何内容。

我尝试了以下方法:

     chart: {
      'type': 'TreeMap',
      'displayed': true,
      'data': {
        'cols': [
          {
            'id': 'sitename'
          },{
            'id': 'quantity'
          },{
            'id': 'state'
          }
        ],
        'rows': [
          {
            'c': [
               {
                'v': 'Section 1'
              },{
                'v': '50000'
              },{
                'v': '2'
              }
            ]
          },{
            'c': [
               {
                'v': 'Section 2'
              },{
                'v': '2500'
              },{
                'v': '0'
              }
            ]
          }
        ]
      },
      'options': {
        backgroundColor: { fill:'transparent' }
      },
    formatters: {}
    }

有什么想法吗?

发现树状图需要一个父列和一个父行。以下示例解决了该问题

myChart = {
  type: 'TreeMap',
  displayed: true,
  data: {
    cols: [{
      id: 'sitename',
      type: 'string'
    }, {
      id: 'parent',
      type: 'string'
    }, {
      id: 'quantity',
      type: 'number'
    }, {
      id: 'state',
      type: 'number'
    }],
    rows: [
      {
      c: [{
        v:'all'
      }, {
        v:null
      }, {
        v:0
      }, {
        v:0
      }]
    }, {
      c: [{
        v: 'Segment 1'
      }, {
        v: 'all'
      }, {
        v: 50000
      }, {
        v: 3
      }]
    }, {
      c: [{
        v: 'Segment 2'
      }, {
        v: 'all'
      }, {
        v: 2500
      }, {
        v: 0
      }]
    }]
  },
  options: {
    backgroundColor: {
      fill: 'transparent'
    },
    minColor: '#f00',
    midColor: '#ddd',
    maxColor: '#0d0',
    noColor: '#FF0000',
    fontColor: 'black',
    showScale: true,
    showTooltips: false
  }
}

同时将第 4 列设置为空将传递 noColor 中设置的颜色。在这里得到了 Balrog30 的帮助:

https://github.com/angular-google-chart/angular-google-chart/issues/168