Highcharts Not Loading In Tabs
Solution 1:
It is because, when you initialize the highcharts, except first tab, others are not in DOM, and therefore are not available to be initialized.
You will have to listen for some tab-change event, and then reinitialize the highcharts after the tab is rendered.
Solution 2:
I know it" s="" late,="" but="" i="" am="" sure="" it="" will="" help="" someone="" because="" took="" me="" forever="" to="" find="" this="" in="" an="" offhanded="" comment.="" one="" way="" load="" highcharts="" tabs="" is="" lazy="" the="" tab="" with="" angular="" attribute="" You can read the angular tabs documentation here with a more basic example of lazy loading. You don't need a parent/child component structure I have and possibly do something like this<ng-template matTabContent> like so
<mat-tab-group class="secondary-tab-group has-header"
[dynamicHeight]="true"
mat-stretch-tabs>
<mat-tab label="first">
<child-component></child-component>
</mat-tab>
<mat-tab label="second">
<ng-template matTabContent>
<highcharts-child-component [list]="dataList"></highcharts-child-component>
</ng-template>
</mat-tab>
</mat-tab-group>
<mat-tab-group class="secondary-tab-group has-header"
[dynamicHeight]="true"
mat-stretch-tabs>
<mat-tab label="first">
hello world
</mat-tab>
<mat-tab label="second">
<ng-template matTabContent>
<div>
<chart (load)="saveInstance($event.context)" [optoins]="highchartOptions"></chart>
</div>
</ng-template>
</mat-tab>
</mat-tab-group>
Post a Comment for "Highcharts Not Loading In Tabs"