angulargoogle-visualizationorgchartangular-google-chart

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.


Solution

  • 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));
      }
    }