Population by age

Up to 31 December of each year, 2015 - 2019

by Federico Ferraris Sánchez

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>
<script src="https://code.highcharts.com/modules/accessibility.js"></script>

<figure class="highcharts-figure">
    <div id="container"></div>
    <p class="highcharts-description">
    </p>
</figure>

CSS

#container {
    height: 570px; 
}

.highcharts-figure, .highcharts-data-table table {
    min-width: 310px; 
    max-width: 1250px;
    margin: 1em auto;
}

.highcharts-data-table table {
    font-family: Verdana, sans-serif;
    border-collapse: collapse;
    border: 1px solid #EBEBEB;
    margin: 10px auto;
    text-align: center;
    width: 100%;
    max-width: 500px;
}
.highcharts-data-table caption {
    padding: 1em 0;
    font-size: 1.2em;
    color: #555;
}
.highcharts-data-table th {
	font-weight: 600;
    padding: 0.5em;
}
.highcharts-data-table td, .highcharts-data-table th, .highcharts-data-table caption {
    padding: 0.5em;
}
.highcharts-data-table thead tr, .highcharts-data-table tr:nth-child(even) {
    background: #f8f8f8;
}
.highcharts-data-table tr:hover {
    background: #f1f7ff;
}

JavaScript

Highcharts.chart('container', {
    chart: {
        type: 'column'
    },
    exporting: {
      sourceWidth: 1200,
      sourceHeight: 600,
      allowHTML: true
    },
    title: {
        text: 'Population by age 2015 - 2019'
    },
    subtitle: {
        text: 'Up to 31 December of each year'
    },
    legend: {
        layout: 'horizontal',
        align: 'center',
        verticalAlign: 'bottom',
        borderWidth: 1,
        backgroundColor:
            Highcharts.defaultOptions.legend.backgroundColor || '#FFFFFF'
    },
    xAxis: {
    		title: {
        	text: 'Years old'
        },
        categories: [
            60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85
        ]
    },
    yAxis: {
        title: {
            text: 'Inhabitants'
        },
        tickAmount: 13
    },
    tooltip: {
        shared: true
        //,valueSuffix: ' units'
    },
    credits: {
        enabled: false
    },
    plotOptions: {
      series: {
      	//groupPadding: 10.2,
        dataLabels: {
          enabled: false
        }
      }
    },
    series: [{
        name: '2015',
        data: [1088896,1065097,1027643,1022255,998165,993544,955943,868455,811207,702735,613134,812814,817825,784324,941096,974315,940958,855435,775260,723930,669656,590675,448413,419124,396544,2204791]
    }, {
        name: '2016',
        data: [1117653,1079772,1055517,1017147,1011191,986117,980637,942547,855561,798439,690163,601545,796592,800408,766229,917490,947484,912772,826172,745639,692490,636554,557352,419843,388732,2246939]
    }, {
        name: '2017',
        data: [1144314,1108669,1070337,1045334,1006399,999682,973689,967521,928887,841915,784815,676907,589302,779008,781877,746906,892443,918608,882457,795009,713800,658716,601037,521955,389704,2265473]
    }, {
        name: '2018',
        data:...