Deaths (Timeline) by age group

Weekly

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: 'line'
    },
    exporting: {
      sourceWidth: 1200,
      sourceHeight: 600,
      allowHTML: true
    },
    title: {
        text: 'Deaths (Timeline) by age group 2016 - 2020'
    },
    legend: {
        layout: 'horizontal',
        align: 'right',
        verticalAlign: 'bottom',
        floating: true,
        x: 0,
        y: -75,
        width: 1100,
        borderWidth: 1,
        backgroundColor:
            Highcharts.defaultOptions.legend.backgroundColor || '#FFFFFF',
        labelFormatter: function() {
          var nSum = 0;
          
          for(i = 0; i < this.yData.length; i++){
          	nSum = nSum + this.yData[i];
          }
          
          return this.name + ', Σ: ' + (nSum).toLocaleString();
        }
    },
    xAxis: {
    		title: {
        	text: 'Calendar week'
        },
        categories: [
            
            '2016-1',2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,'2017-1',2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,'2018-1',2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,'2019-1',2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,'2020-1',2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52
        ]
    },
    yAxis: {
        title: {
            text: 'Deaths'
        },
        min: -2500,
        max: 17500
    },
    tooltip: {
        shared: true
        //,valueSuffix: ' units'
    },
    credits: {
        enabled: false
    },
    plotOptions: {
      series: {
         ...