我想在Highchart中的Angular Gauge表中实现类别并删除数字,如here所示。到目前为止,我所做的是this。
$(function () {
$('#container').highcharts({
chart: {
type: 'gauge',
plotBackgroundColor: null,
plotBackgroundImage: null,
plotBorderWidth: 0,
plotShadow: false
},
title: {
text: null
},
pane: {
startAngle: -150,
endAngle: 150,
background: [{
backgroundColor: {
linearGradient: { x1: 0, y1: 0, x2: 0, y2: 1 },
stops: [
[0, '#FFF'],
[1, '#333']
]
},
borderWidth: 0,
outerRadius: '109%'
}, {
backgroundColor: {
linearGradient: { x1: 0, y1: 0, x2: 0, y2: 1 },
stops: [
[0, '#333'],
[1, '#FFF']
]
},
borderWidth: 1,
outerRadius: '107%'
}, {
// default background
}, {
backgroundColor: '#DDD',
borderWidth: 0,
outerRadius: '105%',
innerRadius: '103%'
}]
},
// the value axis
yAxis: {
min: 0,
max: 100,
type:'category',
categories:['One','Two','Three','Four','Five'],
tickPixelInterval: 30,
tickWidth: 2,
tickPosition: 'outside',
tickLength: 20,
tickColor: '#666',
title: {
text: null
},
plotBands: [{
from: 0,
to: 60,
color: '#55BF3B' // green
}, {
from: 60,
to: 80,
color: '#DDDF0D' // yellow
}, {
from: 80,
to: 100,
color: '#DF5353' // red
}]
},
series: [{
name: 'Speed',
data: [80]
}]
});
});
我不想要图表中的任何数字,如附图所示。 任何帮助表示赞赏。 感谢。
答案 0 :(得分:1)
您有蜂巢值(80),而只有5个类别。标准化值以获得所需结果:http://jsfiddle.net/buaqgvq2/1
$('#container').highcharts({
chart: {
type: 'gauge'
},
pane: {
startAngle: -150,
endAngle: 150
},
// the value axis
yAxis: {
min: 0,
max: 4,
type:'category',
categories:['One','Two','Three','Four','Five'],
tickPixelInterval: 30,
tickWidth: 2,
tickPosition: 'outside',
tickLength: 20,
tickColor: '#666',
title: {
text: null
},
plotBands: [{
from: 0,
to: 2,
color: '#55BF3B' // green
}, {
from: 2,
to: 3,
color: '#DDDF0D' // yellow
}, {
from: 3,
to: 4,
color: '#DF5353' // red
}]
},
series: [{
name: 'Speed',
data: [3.4]
}]
});