Highcharts Demo

author(s): Torstein Hønsi

by ninachroscicka

HTML

<script src="https://code.jquery.com/jquery-3.1.1.min.js"></script>
<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; max-width: 800px; height: 400px; margin: 0 auto"></div>

JavaScript

// Data gathered from http://populationpyramid.net/germany/2015/

// Age categories
var categories = [
    "Anger/Embarassment","Amusement","Objects","Fear","Happiness","Nature","Food and drinks","Owoce i warzywa","Sadness","Sport","Satisfaction"
];

Highcharts.chart('container', {
    chart: {
        type: 'bar'
    },
    title: {
        text: ''
    },
    subtitle: {
        text: ''
    },
    xAxis: [{
        categories: categories,
        reversed: false,
        lineWidth: 0,
        minorGridLineWidth: 0,
        lineColor: 'transparent',
        minorTickLength: 0,
        tickLength: 0,
        labels: {
            step: 1
        }
    }],
    yAxis: {
        title: {
            text: null
        },
        labels: {
            formatter: function () {
                return this.value;
            }
        }
    },

    plotOptions: {
        series: {
        		borderRadius: 5,
            stacking: 'normal',
            zones: [{
            value: 0, 
            color: '#bf1515' 
        },{
            color: '#336633'
        }]
        }
    },

    tooltip: {
        formatter: function () {
            return '<b>' +  this.point.category + '</b><br/>' +
                'N: ' + Highcharts.numberFormat(this.point.y);
        }
    },

    series: [{
        name: 'Emoji',
        data: [
            5,-5,10,-10,2,2,8,-8,3,-7
        ]
    }]
});