首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >在Angular 6应用程序中添加highchart3d

在Angular 6应用程序中添加highchart3d
EN

Stack Overflow用户
提问于 2018-10-12 20:09:34
回答 1查看 78关注 0票数 0

我正在尝试在Angular 6应用程序中添加highcharts3d。如何在应用程序中使用highchart3d以3d格式显示图表。导入highchart3d库后出现编译错误,如下:

从‘highcharts/highcharts-3D’导入Highcharts3d;

谢谢,

EN

回答 1

Stack Overflow用户

发布于 2018-10-12 20:24:27

安装angular2-来自npm的highcharts:

npm install angular2-highcharts --save

应用程序模块中的设置:

代码语言:javascript
复制
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 {}

并在组件中使用它:

代码语言:javascript
复制
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

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/52779247

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档