Open leonyah opened 7 years ago
I found a solution, but would appreciate a confirmation whether I did this right, especially the casting to Highcharts.Static on this line: this.hoptions = (<Highcharts.Static> highchartStatic).getOptions()
import { Component } from '@angular/core';
import {HighchartsStatic} from 'angular2-highcharts/dist/HighchartsService';
import * as Highcharts from "highcharts";
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.css']
})
export class AppComponent {
constructor(highchartStatic:HighchartsStatic) {
this.options = {
title : { text : 'simple chart' },
series: [{
data: [29.9, 71.5, 106.4, 129.2],
}]
};
this.hoptions = (<Highcharts.Static> highchartStatic).getOptions();
}
options: Highcharts.Options;
hoptions:Highcharts.Options;
}
Could you share an example on how to access the highchart static methods, such as Highcharts.getOptions().colors ? Furthermore, how to do it using highcharts type definitions. I can't figure out how to convert HighchartsStatic to Highchart.Static type definition. Thank you.
I did "npm install --save @types/highcharts", but still having trouble figuring out how to cast to Highcharts.Static