Here's what I'm working with: http://jsfiddle.net/josip0423/prJjY/171/
I've been wrestling with this for the past few hours without getting anywhere. I'm very new to javascript, and just found highcharts today.
By default the stack label shows the total of both series (this.total). What I want to do is show the percent of one of the series (value of "Complete" series / this.total * 100).
I can't figure out how to extract the value for the "Complete" series.
yAxis: {
stackLabels: {
style: {
color: 'black'
},
enabled: true,
formatter: function() {
**return this.total**
}
}
}
So in the end, my graph looks exactly the same, except the labels above each column will show the percent for the "Complete" series.
Thanks in advance!
You can do that by getting the series object from the formatter callback function.
stackLabels: {
style: {
color: 'black'
},
enabled: true,
formatter: function() {
return (this.axis.series[1].yData[this.x] / this.total * 100).toPrecision(2) + '%';
}
}
Here is the jsfiddle for your case:
http://jsfiddle.net/prJjY/183/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With