我正在尝试使用Highcharts在Angular中显示一个朝阳图。图表可以显示,但是颜色有问题。我提到了一个颜色数组,但是图表只显示了数组中的第一个颜色。有人能告诉我这里做错了什么吗?
以下是我的代码:
this.chart = Highcharts.chart('container', {
chart: {
type: 'sunburst',
height: '100%'
},
colors: ['#2f7ed8', '#0d233a', '#8bbc21', '#910000', '#1aadce',
'#492970', '#f28f43', '#77a1e5', '#c42525', '#a6c96a'],
title: {
text: 'PSec GEARS Function Usage'
},
subtitle: {
text: 'Top 10 Functions used as % per User for the last Month'
},
credits: {
enabled: false
},
tooltip: {
headerFormat: '',
pointFormat: 'The population of <b>{point.name}</b> is <b>{point.value}</b>'
},
series: [{
type: "sunburst",
data: this.dataValues,
cursor: 'pointer',
dataLabels: {
format: '{point.name}',
filter: {
property: 'innerArcLength',
operator: '>',
value: 16
},
rotationMode: 'circular'
},
levels: [{
level: 1,
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
}
}]
}]
});
这是我得到的输出图表的图像:
1条答案
按热度按时间moiiocjp1#
您没有在发送的代码中包含数据,因此很难说您到底做错了什么,但朝阳图表中的数据结构应该如下所示:
官方演示:https://www.highcharts.com/demo/sunburst
API:https://api.highcharts.com/highcharts/series.sunburst.data