首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >无法在Angular2中获得谷歌组织结构图的选择

无法在Angular2中获得谷歌组织结构图的选择
EN

Stack Overflow用户
提问于 2017-02-28 00:09:08
回答 1查看 283关注 0票数 0

我的代码看起来是:

代码语言:javascript
复制
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()只返回"0“。顺便说一下,createWrapped正在使用google.visualization.ChartWrapper。

那我做错什么了?我的意思是,除了试图让这个在TypeScript下发挥作用之外。:)

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2017-02-28 12:52:53

getSelection()是图表方法,而不是ChartWrapper方法

而是..。

this.chart.getChart().getSelection()

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/42498083

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档