I am trying to add and remove series and axes dynamically. I am able to add series/axes dynamically, but while removing the series I am getting an error message in console saying "Requested Axes does not exist".
Adding series and axes:
Code: Select all
this.highchartCustomObj.addAxis({
id: '1-Y',
lineWidth: 2,
gridLineDashStyle: 'Solid',
gridLineWidth:1,
title: {
text: '1st y axis',
style: {
fontSize: '10px',
},
enabled: true
},
labels: {
format: '{value:.2f}',
style: {
fontSize: '10px',
},
},
opposite: false
},false,false);
this.highchartCustomObj.addSeries({
name: '1-name',
id: '1',
yAxis:'1-Y',
data:data.data
},false);
Code: Select all
this.highchartCustomObj.get('1').remove(false);
this.highchartCustomObj.get('1-Y').remove(false);
this.updateChartFlag=true;
Code: Select all
<highcharts-chart [Highcharts]="Highcharts"
[options]="chartOptions"
[(update)]="updateChartFlag"
[oneToOne]=true
(chartInstance)="logChartInstance($event)"
style="width: 100%; height: 400px; display: block;"
></highcharts-chart>
Code: Select all
highchartCustomObj:any={};
logChartInstance(chart: any) {
this.highchartCustomObj=chart;
console.log('Chart instance: ', chart);
}
Bibek N