【发布时间】:2020-09-30 13:04:04
【问题描述】:
我正在为我的项目使用 High Chart Js 库。我创建了饼图。它运作良好。我需要如何更改饼图颜色。我怎么做?请检查我的javascript代码
Highcharts.chart('假阳性图', { 图表: { 类型:“馅饼” },
title: {
text: 'False Positive % Suspicious incidents',
style: {fontSize: '12px',
fontFamily :"'Helvetica Neue', 'Helvetica', 'Arial', sans-serif",
fontWeight: 'bold',
color: '#black',
position:'top'
}
},
credits: {enabled: false},
legend: {enabled: false},
tooltip: {
headerFormat: '<span style="font-size:11px">{series.name}</span><br>',
pointFormat: '<span style="color:{point.color}">{point.name}</span>: <b>{point.percentage:.1f}%</b> of total<br/>'
},
series: [
{
name: "",
colorByPoint: true,
data: $scope.actionCount
}
],
drilldown: {
drillUpButton: {
position: {
relativeTo:"plotBox",
verticalAlign: 'right'
}
},
series: [
{
name: "REPORT",
id: "REPORT",
data: $scope.reportCount
},
{
name: "DISCOUNT",
id: "DISCOUNT",
data: $scope.discountCount
}
]
}
});
【问题讨论】:
-
您需要使用颜色属性。你可以在这里查看一个例子jsfiddle.net/gh/get/library/pure/highcharts/highcharts/tree/…
-
@pc_coder 我如何更改添加颜色属性的代码??
标签: javascript css highcharts