JSFiddle - React, Tailwind, and code Playground

by Torstein Hønsi

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; max-width: 800px; height: 500px; margin: 0 auto"></div>

JavaScript

// Data gathered from http://populationpyramid.net/germany/2015/
$(function () {
    // Age categories
    var categories = ['0-4', '5-9', '10-14', '15-19',
            '20-24', '25-29', '30-34', '35-39', '40-44',
            '45-49', '50-54', '55-59', '60-64', '65-69',
            '70-74', '75-79', '80-84', '85-89', '90-94',
            '95-99', '100 + '];
    $(document).ready(function () {
        Highcharts.chart('container', {
            chart: {
                type: 'bar'
            },
            title: {
                text: 'Population pyramid for Germany, 2015'
            },
            subtitle: {
                text: 'Source: <a href="http://populationpyramid.net/germany/2015/">Population Pyramids of the World from 1950 to 2100</a>'
            },
            xAxis: [{
                categories: categories,
                reversed: false,
                labels: {
                	align: 'center',
                    step: 1,
                    reserveSpace: false,
                    x: -5
                },
                lineWidth: 0,
                tickLength: 0,
                left: '50%'
            }],
            yAxis: [{
                title: {
                    text: null
                },
                labels: {
                	format: '{value}%'
                },
                reversed: true,
                left: 0,
                width: '45%',
                offset: 0
            }, {
                title: {
                    text: null
                },
                labels: {
                	format: '{value}%'
                },
                left: '55%',
                width: '45%',
                offset: 0
            }],

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

            tooltip: {
                format: '<b>{series.name}, age {point.category}</b><br/>Population: {point.y}'
            },

            series:...