Highcharts Demo

author(s): Torstein Hønsi

by subhamgupta026

HTML

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

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

JavaScript

Highcharts.chart('container', {
    chart: {
        type: 'bar'
    },
    title: {
        text: 'Stacked bar chart'
    },
    xAxis: {
        categories: ['Apples', 'Oranges', 'Pears', 'Grapes', 'Bananas'],
        ticks: false,
/*                 minorTickLength: 1,
                        minorTickWidth: 10,
                minorTickInterval: 'auto' */
        tickWidth: 0,
                labels: {
            formatter: function () {
                return this.pos+1 + '. '+
                    this.value ;
            },
            align: 'left',
            reserveSpace: true,
        }
        

        
    },
    yAxis: {
        min: 0,
        title: {
            text: null
        },
        tickInterval: 25,
        max: 100,
        /* offset: -5
        */
                labels: {
            format: '{value} %',
                        align: 'center',
                        y:0,

        }
    },
    legend: {
        reversed: true
    },
    plotOptions: {
        series: {
            stacking: 'normal'
        }
    },
    series: [{
        name: 'John',
        data: [50, 30, 40, 70, 20]
    }, {
        name: 'Jane',
        data: [20, 20, 30, 20, 10]
    }, {
        name: 'Joe',
        data: [30, 40, 40, 20, 50]
    }]
});