简体   繁体   中英

How to get childrenIndexes of a node in Angular Google Charts (OrgChart)?

I am using angular google charts to draw an org chart. Everything works fine, but I cannot use the method getChildrenIndexes(row) of the library. If anyone can help me with a way to get child indexes of a selected node? For reference, I am following this repo.

So, I was able to resolve the issue and will post the answer for the people who might face the same issue.

My HTML looks like this,

<google-chart #chart [title]="title" [type]="type" [data]="data" [columns]="columnNames" [options]="options" (select)="onSelect($event)">
</google-chart>

My component.ts

export class EditorComponent implements OnInit, AfterViewInit {
  @ViewChild('chart') chart;
  onSelect(event): void{
    console.log(this.chart.chart.
        getChildrenIndexes(event.selection[0].row));
  }
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM