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,
        tickWidth: 0,
                labels: {
/*             formatter: function () {
                var label = this.axis.defaultLabelFormatter.call(this);
            
                // Use thousands separator for four-digit numbers too
                     if (/^[0-9]{4}$/.test(label)) {
                    return Highcharts.numberFormat(this.value, 0);
                }
                return label; /
            } 

        
    },
    yAxis: {
        min: 0,
        title: {
            text: null
        },
        tickInterval: 25,
        max: 100,
        /* offset: -5
        */
        x: -2,
                labels: {
            format: '{value} %'
        }
    },
    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]
    }]
});