我想在我的angular2应用程序中插入实时图表,我正在使用angular2-highcharts。实时图与angular2-highcharts
npm install angular2-highcharts --save
app.component.ts
import { Component } from '@angular/core';
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.css'],
})
export class AppComponent {
title = 'app works!';
options: Object;
constructor() {
this.options = {
title : { text : 'simple chart' },
series: [{
data: [29.9, 71.5, 106.4, 129.2],
}]
};
}
}
app.component.html
<chart [options]="options"></chart>
app.module.ts
import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { FormsModule } from '@angular/forms';
import { HttpModule } from '@angular/http';
import { AppComponent } from './app.component';
import {ChartModule} from "angular2-highcharts";
@NgModule({
declarations: [
AppComponent
],
imports: [
BrowserModule,
FormsModule,
HttpModule,ChartModule
],
providers: [],
bootstrap: [AppComponent]
})
export class AppModule { }
我有这个错误时运行我的angular2应用程序: “没有为HighchartsStatic提供商!”。 在此先感谢。
ChartModule.forRoot()不工作 – naruto
你读过[文件](https://github.com/gevgeny/angular2-highcharts)?清除所有可能的语法... – AngularChef
file systemjs.config.js not found ... map:{ ... 'angular2-highcharts':'node_modules/angular2-highcharts', 'highcharts': 'node_modules/highcharts', } ... 包:{ ... highcharts:{ 主: './highcharts.js', defaultExtension: 'JS' }, 'angular2-highcharts':{ 主:' ./index.js' , defaultExtension:'js' } } – naruto