Установить angular2-highcharts из npm:
npm install angular2-highcharts --save
Настройка в модуле приложения:
import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { ChartModule } from 'angular2-highcharts';
import { App } from './App';
@NgModule({
imports: [
BrowserModule,
ChartModule.forRoot(require('highcharts')
],
declarations: [App],
bootstrap: [App]
})
export class AppModule {}
И использовать его в компоненте:
import { Component } from '@angular/core';
@Component({
selector: 'simple-chart-example',
template: `
<chart [options]="options"></chart>
`
})
export class App {
constructor() {
this.options = {
title : { text : 'simple chart' },
series: [{
data: [29.9, 71.5, 106.4, 129.2],
}]
};
}
options: Object;
}
Подробнее здесь: https://www.npmjs.com/package/angular2-highcharts#add-highcharts-modules