Highcharts in Angular – accessing the API

It needs to be done in 2 steps. First you change the value inside the chartOption Object. Second you update the chart.

in your component you add a function like this for exemple:

update(){
  this.myOptions.series = [{
    name: 'Oceania',
    data: [2, 2, 2, 6, 13, 30, 46]
  }]
  this.updateFromInput = true;
}

And in your html:

<highcharts-chart 
  [Highcharts]="Highcharts"
  [options]="myOptions"
  [(update)]="updateFromInput">
</highcharts-chart>
<button (click)="update()" class="btn">Add</button>

an basic exemple here

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top