CHART - Bar Chart Labels Inside Bars
by bizamajig
HTML
<script type="text/javascript" src="http://highcharts.com/js/testing-exporting.js"></script>
<div id="container" style="height: 200px"></div>
JavaScript
$(document).ready(function () {
var chart;
var options = {
chart: {
renderTo: 'container'
},
credits: {
enabled: false
},
title: {
text: null
},
legend: {
enabled: false
},
plotArea: {
shadow: null,
borderWidth: null,
backgroundColor: null
},
xAxis: {
categories: []
},
yAxis: {
title: {
text: 'This is the y-axis'
}
},
tooltip: {
formatter: function () {
return '<b>' + this.x + '</b><br/>' + this.series.name + ': ' + this.y + '<br/>' + 'Total: ' +this.point.stackTotal;
}
},
plotOptions: {
column: {
stacking: 'normal',
dataLabels: {
enabled: true,
formatter: function () {
return Math.round(this.y);
},
color: (Highcharts.theme && Highcharts.theme.dataLabelsColor) || 'white'
}
}
},
series: [{
name: 'Series A',
data: [353, 2378],
type: 'column'
}, {
name: 'Series B',
data: [321, 23],
type: 'column'
}, {
name: 'Series C',
data: [],
type: 'column'
}, {
name: 'Series D',
...