Ab Angular CLI 1.0-RC.1 und aktuelles angular2-highcharts, das für mich arbeitet (siehe auch dies die laufende Diskussion für die empfohlene Lösung https://github.com/gevgeny/angular2-highcharts/issues/156):
npm install --save angular2-highcharts
npm install --save @types/highcharts
In typings.d.ts hinzufügen: declare var require: any;
Dann in app.module.ts:
import { ChartModule } from 'angular2-highcharts';
import {HighchartsStatic} from 'angular2-highcharts/dist/HighchartsService';
export function highchartsFactory() {
var hc = require('highcharts');
var hcm = require('highcharts/highcharts-more');
var exp = require('highcharts/modules/exporting');
hcm(hc);
exp(hc);
return hc;
}
@NgModule({
declarations: [
AppComponent
],
imports: [
BrowserModule,
FormsModule,
HttpModule,
ChartModule
],
providers: [{provide: HighchartsStatic, useFactory: highchartsFactory}],
bootstrap: [AppComponent]
})
export class AppModule { }
Alte Antwort für frühere Version:
Wenn Sie Winkel cli (webpack) und angular2-highcharts, das ist für mich gearbeitet:
import {Highcharts} from 'angular2-highcharts';
require('highcharts/modules/exporting')(Highcharts);
ich denke, das nicht die Frage gar nicht beantworten - dies zeigt nur, wie highchart Chart – Leonya