Deaths percentage (w/o COVID) by age group 2016 - 2020
Weekly 0-59, 60-79,80+
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 percentage (w/o COVID) by age group 2016 - 2020'
},
legend: {
layout: 'vertical',
align: 'right',
verticalAlign: 'bottom',
rtl: true,
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 + ', x̅: ' + (nSum / this.yData.length).toFixed(2);
}
},
xAxis: {
title: {
text: 'Calendar week'
},
categories: [
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: 'Percentage'
},
tickAmount: 12,
labels: {
format: '{value} %'
},
min: 0,
max: 66
},
tooltip: {
shared: true
//,valueSuffix: ' units'
},
credits: {
enabled: false
},
plotOptions: {
series: {
marker: {
radius: 0
},
dataLabels: {
enabled: true,
style: {
fontSize: '16px',
fontWeight: 'bold'
},
formatter: function() {
var dataMax = this.series.dataMax;
if (this.y === dataMax) {
return this.y;
}
}
}
}
},
series: [{
name: '2016 - 0-59',
color: 'rgba(29, 40, 189, .7)',
data:...