我想要实现这样的目标。
这是我到目前为止所拥有的:
Highcharts.chart('container', {
chart: {
type: 'pie'
},
title: {
text: 'Browser market share, January, 2018'
},
subtitle: {
text: `<div>80%</div> of Total`,
align: "center",
verticalAlign: "middle",
style: {
"fontSize": "7px",
"textAlign": "center"
},
x: 0,
y: -2,
useHTML: true
},
plotOptions: {
pie: {
shadow: false,
center: ["50%", "50%"],
dataLabels: {
enabled: false
},
states: {
hover: {
enabled: false
}
},
size: "45%",
innerSize: "95%",
borderColor: null,
borderWidth: 8
}
},
tooltip: {
valueSuffix: '%'
},
series: [{
y: 80,
color: {
linearGradient: {
x1: 0,
x2: 0,
y1: 0,
y2: 1
},
stops: [
[0, "#000"],
[1, "#b0bfc6"]
]
},
name: "Speed"
},
{
y: 20,
color: "#000",
name: "Non Prioritised"
}],
});
这是 fiddle : https://jsfiddle.net/gm8krq9L/
但是我无法让不同的颜色在图表上显示进度效果。我看到有一种类型称为:chart:solidgauge
,但是我的应用程序不支持,因为我必须包含solidgauge 文件才能加载这种图表。有没有办法使用饼图类型来实现此目的?
谢谢
最佳答案
您想要的称为圆环图图表。我已经为这样的图表做了一个例子,是不是类似 this example你要?
无论如何,here's a working example with your fiddle .
数据与您使用的数据类似:
series: [{
innerSize: '80%',
data: [{
name: 'Speed',
y: 80,
color: '#e7eaeb'
}, {
name: 'Non Prioritised',
y: 20,
}]
}],
关于javascript - 如何使用 highcharts 显示圆形进度饼图,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60001182/