0

我必须在下面提到的 arraytodatatable 上调用 onclick。请帮助我正确的语法。在数据表内单击时,应调用一个函数。

<script type="text/javascript" src="https://www.google.com/jsapi"></script>
<script type="text/javascript">
  google.load("visualization", "1", {packages:["treemap"]});
  google.load("visualization", "1", {packages:["corechart"]});

  google.setOnLoadCallback(drawChart);
  function drawChart() {
    // Create and populate the data table.
    var data = google.visualization.arrayToDataTable([
      ['Location', 'Parent', 'Market trade volume (size)', 'Market increase/decrease (color)'],
      ['IDC',    null,                 0,                               0],
      ['AVANADE','IDC',10,100],
      ['AVA-APAC','AVANADE',10,0],
      ['AVA-CAP','AVANADE',10,100],
      ['AVA-EALA-ROE','AVANADE',10,0],
      ['AVA-EALA-UKI','AVANADE',10,0],
      ['AVA-NA-EAST','AVANADE',10,-100],
      ['AVA-NA-KeyAcc','AVANADE',10,-100],
      ['AVA-NA-WEST','AVANADE',10,100],
      ['AVA-TI','AVANADE',10,0],
      ['PRD','IDC',10,0],
      ['PRD-APAC','PRD',20,-100],
      ['PRD-CAP','PRD',20,100],
      ['PRD-EALA-ROE','PRD',200,-100],
      ['PRD-EALA-UKI','PRD',20,-100],
      ['PRD-NA-EAST','PRD',20,-100],
      ['PRD-NA-KeyAcc','PRD',20,100],
      ['PRD-NA-WEST','PRD',20,100],
      ['PRD-TI','PRD',20,100]
    ]);
4

1 回答 1

0

尝试这个

google.visualization.events.addListener(data, 'select', selectHandler);

其中 selectHandler 是您要调用的函数

于 2013-07-17T10:46:58.437 回答