Reputation: 4187
I am using ng-highcharts and I'm trying to create a gauge that can handle negative values, I have almost got there. However, I want zero to be at the top (in others words, I want the chart to be rotated 90 degrees to the right), and for some reason, the -200
value is printed twice/overlapping. What am I missing/doing wrong?
http://jsfiddle.net/Hjdnw/2006/
this is what it should ideally look like, but I want the same thing in ng-highcharts so I can use in my angular application
http://jsfiddle.net/5rncm2nn/1/
Upvotes: 0
Views: 366
Reputation: 201
I tried creating my own directive instead of using ng-highcharts,and its working as expected for me.
Also remove the options object which is wrapping the chart object in your config, that might also be creating problem
Use this config
{
chart: {
type: 'gauge',
plotBackgroundColor: null,
plotBackgroundImage: null,
plotBorderWidth: 0,
plotShadow: false
},
title: {
text: 'Speedometer'
},
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: -200,
max: 200,
minorTickInterval: 'auto',
minorTickWidth: 1,
minorTickLength: 10,
minorTickPosition: 'inside',
minorTickColor: '#666',
tickPixelInterval: 30,
tickWidth: 2,
tickPosition: 'inside',
tickLength: 10,
tickColor: '#666',
labels: {
step: 2,
rotation: 'auto'
},
title: {
text: 'km/h'
},
plotBands: [{
from: 0,
to: 200,
color: '#55BF3B' // green
}, { from: -200,
to: 0,
color: '#DF5353' // red
}]
},
series: [{
name: 'Speed',
data: [80],
tooltip: {
valueSuffix: ' km/h'
}
}]
}
Same as yours just removed the options object
Checkout this fiddle
http://jsfiddle.net/Hjdnw/2010/
Upvotes: 1