我正在尝试在Angular 6应用程序中添加highcharts3d。如何在应用程序中使用highchart3d以3d格式显示图表。导入highchart3d库后出现编译错误,如下:
从‘highcharts/highcharts-3D’导入Highcharts3d;
谢谢,
发布于 2018-10-12 20:24:27
安装angular2-来自npm的highcharts:
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
https://stackoverflow.com/questions/52779247
复制相似问题