# 尝试了导入模块的新方法。(app.module.ts)。在 app.module 中导入了更多模块。在组件中也有带有 Drilldown 的 json structre。仍然无法在页面上呈现
" import { ChartModule, HIGHCHARTS_MODULES } from 'angular-highcharts';
import more from 'highcharts/highcharts-more.src';
import exporting from 'highcharts/modules/exporting.src';"
## Refer : https://github.com/manhar-developer/angularwidCharts
----------------------------------------------------------------------
### - Component Code :
import { Component, OnInit } from '@angular/core';
import { Chart } from 'angular-highcharts';
declare var require: any;
const Highcharts = require('highcharts');
export class LineChartComponent implements OnInit {
constructor() { }
chart1 = new Chart({
// Created pie chart using Highchart
chart: {
type: 'pie',
options3d: {
enabled: true,
alpha: 45
}
},
title: {
text: 'Contents using Pie chart'
},
subtitle: {
text: '3D donut in Highcharts'
},
plotOptions: {
pie: {
innerSize: 100,
depth: 45
}
},
// 能够在渲染时使用系列并正常工作,但在单击时,钻取 //down 不起作用
series: [{
name: 'Operating Systems',
data: [
{
name: 'Windows',
y: 88.19,
drilldown: 'windows-versions'
},
['MacOSX', 9.22],
['Linux', 1.58],
['Others', 1.01]
]
}],
drilldown: {
series: [{
name: 'Windows versions',
id: 'windows-versions',
data: [
['Win 7', 55.03],
['Win XP', 15.83],
['Win Vista', 3.59],
['Win 8', 7.56],
['Win 8.1', 6.18]
]
}]
}
});
-------------------------
本节导入了chartModule、Highcharts_modules等模块app.module.ts
import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import {ChartModule , HIGHCHARTS_MODULES} from 'angular-highcharts';
import more from 'highcharts/highcharts-more.src';
import exporting from 'highcharts/modules/exporting.src.js';
import { AppComponent } from './app.component';
import { LineChartComponent } from './components/line-chart/line-chart.component';
export function highchartsModules() {
// apply Highcharts Modules to this array
return [ more,exporting ];
}
@NgModule({
declarations: [
AppComponent,
LineChartComponent
],
imports: [
BrowserModule,ChartModule
],
providers: [],
bootstrap: [AppComponent]
})
export class AppModule { }