Highcharts - Label individual bars in grouped bar graph

Kind of a hack — need a better method.

by supertrue

HTML

<script src="http://code.highcharts.com/highcharts.js"></script>
<div id="container" style="min-width: 400px; height: 400px; margin: 0 auto"></div>

JavaScript

$(function () {
    var chart;
    $(document).ready(function() {
        chart = new Highcharts.Chart({
    
            chart: {
                renderTo: 'container',
                type: 'column'
            },
    
            title: {
                text: 'Total fruit consumtion, grouped by gender'
            },
    
            xAxis: [{
                offset: 20,
                categories: ['Apples', 'Oranges', 'Pears', 'Grapes', 'Bananas']
            }, {
                linkedTo: 0,
                offset: 0,
                lineWidth: 4,
                opposite: false,
                labels: {
                    formatter: function(){
                        return 'Male * Female';
                    }
                }
            }],
    
            plotOptions: {
                column: {
                    stacking: 'normal',
                    dataLabels: {
                        enabled: true,
                        color: 'white',
                        // y: -10,
                        backgroundColor: 'rgba(0, 0, 0, 0.5)',
                        borderRadius: 6
                    }
                }
            },
    
            series: [{
                name: 'John',
                data: [5, 3, 4, 7, 2],
                stack: 'male'
            }, {
                name: 'Joe',
                data: [3, 4, 4, 2, 5],
                stack: 'male'
            }, {
                name: 'Jane',
                data: [2, 5, 6, 2, 1],
                stack: 'female'
            }, {
                name: 'Janet',
                data: [3, 0, 4, 4, 3],
                stack: 'female'
            }]
        });
    });
    
});