Highcharts Demo

author(s): Torstein Hønsi

by linus

HTML

<script src="https://code.highcharts.com/highcharts.js"></script>
<script src="https://code.highcharts.com/highcharts-more.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: 'Total fruit consumtion, grouped by gender'
    },

    xAxis: {
        categories: ['2017', 'Apples', 'Oranges', 'Pears', 'Grapes', 'Bananas', '2018']
    },

    yAxis: {
        allowDecimals: false,
        min: 0,
        title: {
            text: 'Number of fruits'
        }
    },

    tooltip: {
        formatter: function () {
            return '<b>' + this.x + '</b><br/>' +
                this.series.name + ': ' + this.y + '<br/>' +
                'Total: ' + this.point.stackTotal;
        }
    },

    plotOptions: {
        column: {
            stacking: 'normal'
        }
    },

    series: [{
        name: 'Apples',
        data: [{x: 0, y:5, name:'2017'}, {x: 6, y:5, name:'2018'}]
    }, {
        name: 'Oranges',
        data: [{x: 0, y:5, name:'2017'}, {x: 6, y:5, name:'2018'}]
    }, {
        name: 'Pears',
        data: [{x: 0, y:5, name:'2017'}, {x: 6, y:5, name:'2018'}]
    }, {
        name: 'Grapes',
        data: [{x: 0, y:5, name:'2017'}, {x: 6, y:5, name:'2018'}]
    }, {
        name: 'Bananas',
        data: [{x: 0, y:5, name:'2017'}, {x: 6, y:5, name:'2018'}]
    }, {    		
        type: 'bubble', 
        connectNulls: true,
        data: [
        		{x: 1, y: 25, z: 13.8, name: 'Apples'},
            {x: 2, y: 25, z: 200.8, name: 'Oranges'},
            {x: 3, y: 25, z: 1.8, name: 'Grapes'},
            {x: 4, y: 25, z: 1.8, name: 'Pears'},
            {x: 5, y: 25, z: 1000, name: 'Banas'}],
        marker: {
            symbol: 'diamond'
        }
    }]
});