html:
<ejs-tab id="tab_default" (selected)='onselected($event)'>
<e-tabitems>
<e-tabitem [header]='headerText[0]'>
<ng-template #content>
<div style='display:block' >
<ejs-chart #chart1>
</ejs-chart>
</div>
</ng-template>
</e-tabitem>
<e-tabitem [header]='headerText[1]'>
<ng-template #content>
<div style='display:block' >
<ejs-chart #chart2>
</ejs-chart>
</div>
</ng-template>
</e-tabitem>
<e-tabitem [header]='headerText[2]'>
<ng-template #content>
<div style='display:block' >
<ejs-chart #chart3>
</ejs-chart>
</div>
</ng-template>
</e-tabitem>
</e-tabitems>
</ejs-tab>
Component.ts:
@ViewChild('chart1') public chart1: ChartComponent;
@ViewChild('chart2') public chart2: ChartComponent;
@ViewChild('chart3') public chart3: ChartComponent;
public onselected(event) {
if (event.selectedIndex == 0) {
this.chart1.refresh();
} else if(event.selectedIndex == 1) {
this.chart2.refresh();
} else {
this.chart3.refresh();
}
} |