您好,我正在将Highchart用于旭日形图,但是遇到错误,我无法得到代码中的错误之处,所以请帮助我。
我的HTML代码是:
<highcharts-chart
[Highcharts]="highcharts1"
[options]="chartOptions1"
style="width: 100%; height: 200px; display: block;">
</highcharts-chart>
Ts代码是
chartData = [
{
id: '2.13',
parent: '1.3',
name: 'Southern Asia'
}
];
highcharts1: typeof Highcharts = Highcharts;
chartOptions1: Highcharts.Options = <any> {
chart: {
height: '100%'
},
title: {
text: 'World population 2017'
},
subtitle: {
text: 'Source <href="https://en.wikipedia.org/wiki/List_of_countries_by_population_(United_Nations)">Wikipedia</a>'
},
series: [{
type: "sunburst",
data: this.chartData,
allowDrillToNode: true,
cursor: 'pointer',
dataLabels: {
format: '{point.name}',
filter: {
property: 'innerArcLength',
operator: '>',
value: 16
}
},
levels: [{
level: 1,
levelIsConstant: false,
dataLabels: {
filter: {
property: 'outerArcLength',
operator: '>',
value: 64
}
}
}, {
level: 2,
colorByPoint: true
},
{
level: 3,
colorVariation: {
key: 'brightness',
to: -0.5
}
}, {
level: 4,
colorVariation: {
key: 'brightness',
to: 0.5
}
}]
}]
};
” 得到以下错误。 错误错误:Highcharts错误#17:www.highcharts.com/errors/17 在c.Chart.h(highcharts.js:12)“ 谁能帮我我在代码中所缺少的内容
答案 0 :(得分:1)
朝阳图需要以下模块modules / sunburst.js。
Sunburst.js位置: https://code.highcharts.com/modules/sunburst.js
API参考: https://www.highcharts.com/docs/chart-and-series-types/sunburst-series
答案 1 :(得分:1)
您需要导入并初始化sunburst
模块:
import * as Highcharts from 'highcharts';
import HC_sunburst from 'highcharts/modules/sunburst';
HC_sunburst(Highcharts);
文档: https://github.com/highcharts/highcharts-angular#to-load-a-module