Highcharts Demo

author(s): Torstein Hønsi

by tin nguyen

HTML

<script src="https://code.highcharts.com/highcharts.js"></script>
<script src="https://code.highcharts.com/modules/exporting.js"></script>

<div id="container" style="min-width: 310px; height: 400px; margin: 0 auto"></div>

JavaScript

Highcharts.chart('container', {
    chart: {
        type: 'column'
    },
    title: {
        text: 'Stacked column chart'
    },
    xAxis: {
        categories: ['Apples', 'Oranges', 'Pears', 'Grapes', 'Bananas']
    },
    yAxis: {
        min: 0,
        title: {
            text: 'Total fruit consumption'
        },
        stackLabels: {
            enabled: true,
            style: {
                fontWeight: 'bold',
                color: (Highcharts.theme && Highcharts.theme.textColor) || 'gray'
            }
        }
    },
    
    
    plotOptions: {
        column: {
            stacking: 'normal',
            dataLabels: {
                enabled: true,
                allowOverlap : true,
               
                color: (Highcharts.theme && Highcharts.theme.dataLabelsColor) || 'white'
            }
        }
    },
    series: [{
        name: 'John',
        data: [5, 5, 5, 7, 2],
        dataLabels: {
                enabled: true,
        				x : [-5,5,-5,5,-5],
                },
    }, {
        name: 'Jane',
        data: [2, 2, 3, 2, 1],
        //dataLabels: {
               // enabled: true,
             //   y : [2,null,null,null,null],
            //    },
    }, {
        name: 'Joe',
        data: [3, 4, 4, 2, 5],
       // dataLabels: {
            //    enabled: true,
        		//		y : [2,null,null,null,null],
             //   },
    }]
});