Reputation: 820
I would like to know if is it possible to have a gradient that starts with green on the left (0 value), fading to yellow in the middle and then fading into red at the right side of the "solidGauge" chart.
I tried some configuration in the yAxis but they don't do what i want:
yAxis: {
plotBands: [{
color: {
linearGradient: [300, 300, 0, 0],
stops: [
[0, 'rgb(255, 255, 255)'],
[1, 'rgb(150, 200, 155)']
]
},
from: 0,
to: 100
}],
},
yAxis: {
minColor:'#55BF3B',
maxColor:'#DF5353',
},
yAxis: {
minColor: gaugeValue >= 80 ? '#FF0000' : (gaugeValue >= 60 ? '#FFFF00' : '#00FF00'),
maxColor: gaugeValue >= 80 ? '#FF0000' : (gaugeValue >= 60 ? '#FFFF00' : '#00FF00'),
}
yAxis: {
stops: [
[0.1, '#55BF3B'], // green
[0.5, '#DDDF0D'], // yellow
[0.9, '#DF5353'] // red
],
},
Ok I know that images have different colours because I used different Hex value, btw the result is always the same: a solid color (based on the gaugeValue).
I would like that if my value is 90% I can see gradient green to yellow to red. Something like this:
Any suggestion is welcome.
Thanks
Upvotes: 1
Views: 3446
Reputation: 45079
You need to set color for point as gradient, not for axis. For example: http://jsfiddle.net/n9gfeor2/
series: [{
name: 'Speed',
data: [{
color: {
linearGradient: [0, 0, 300, 0],
stops: [
[0.1, '#55BF3B'], // green
[0.5, '#DDDF0D'], // yellow
[0.9, '#DF5353'] // red
]
},
y: 80
}]
}]
Upvotes: 7
Reputation: 64
This might be the answer: Highchart's gauge with gradient plotband
color: {
linearGradient: [300, 300, 0, 0],
stops: [
[0, 'rgb(255, 255, 255)'],
[1, 'rgb(150, 200, 155)']
]
Upvotes: 0