pyramid using columnrange Label Inside
by kzoon
HTML
<script src="http://code.highcharts.com/v2.3Beta/highcharts.js"></script>
<script src="http://code.highcharts.com/v2.3Beta/highcharts-more.js"></script>
<script src="http://code.highcharts.com/v2.3Beta/modules/exporting.js"></script>
<div id="container" style="min-width: 400px; height: 400px; margin: 0 auto"></div>
JavaScript
$(function() {
window.chart = new Highcharts.Chart({
chart: {
renderTo: 'container',
type: 'columnrange',
inverted: true,
events:{
// load: function(event) {
// posDataLab(this);
// }
}
},
title: {
text: 'Temperature variation by month'
},
subtitle: {
text: 'Observed in Vik i Sogn, Norway, 2009'
},
xAxis: {
categories: ['Phase5', 'Phase4', 'Phase3', 'Phase2', 'Phase1']
},
yAxis: {
title: {
text: ''
}
},
plotOptions: {
columnrange: {
pointPadding: 0,
groupPadding: 0,
//borderWidth: 0,
borderWidth: 3,
borderColor: 'red',
shadow: false,
dataLabels: {
enabled: true,
color: 'white',
formatter: function() {
//suppress the low datalabel
if (this.point.high == this.y) {
return this.y;
} else {
return null;
}
},
y: 0
}
}
},
legend: {
enabled: false
},
series: [
{
data: [
[-1, 1],
[-3, 3],
[-8, 8],
[-10, 10],
[-11.2, 11.2]
]}
]
}, function(chart) {
posDataLab(chart);
});
function posDataLab(chart) {
$.each(chart.series[0].data, function(i, point) {
//debugger;
var newPos =...