无法在 Angular2 中获得 google 组织结构图选择

Can't get google orgchart selection in Angular2

我的代码如下:

drawGraph() {
  let theChart;
  let handler = () => {
    let sel = theChart.getChart().getSelection();
    alert('selection occurred');
    console.log('selection event', sel, Object.keys(sel));
  };

  this.google = this.getGoogle();
  this.dataTable = this.getDataTable();
  this.orgData.fillDataTable(this.dataTable, 'PALA,SRINIVASRAO');
  console.log('data', this.dataTable);
  this.dataTable.setRowProperty(1, 'style', 'border: 0');
  this.chart = this.createWrapped('OrgChart', 'chartDiv', this.dataTable);
  theChart = this.chart;
  this.chart.draw();
  this.google.visualization.events.addListener(this.chart, 'select', handler);
}

图表绘制良好,我的 evert 处理程序被命中但 getSelection() 仅 returns [“0”]。顺便说一句,createWrapped 使用 google.visualization.ChartWrapper。

那我做错了什么?除了尝试让它在 TypeScript 下工作之外,我的意思是。 :)

getSelection()Chart 方法,而不是 ChartWrapper 方法

而是……

this.chart.getChart().getSelection()