Stacked area: Continuous data composition (MSIS atmospheric composition by hight monochrome)
author(s):
Mustapha Mekhatria
by oysteinmoseng
May 31, 2023
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/series-label.js"></script>
<script src="https://code.highcharts.com/modules/accessibility.js"></script>
<figure class="highcharts-figure">
<div id="container"></div>
<p class="highcharts-description">
An accessible area spline chart, showing the composition of gases in the atmosphere at different heights.
</p>
</figure>
CSS
#container {
height: 400px;
min-width: 400px;
max-width: 1000px;
margin: 0 auto;
}
.highcharts-figure,
.highcharts-data-table table {
min-width: 310px;
max-width: 800px;
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: 'areaspline'
},
title: {
text: 'MSIS atmospheric composition by height'
},
subtitle: {
text:
'Source: <a href="https://en.wikipedia.org/wiki/Atmosphere_of_Earth" target="_blank">Wikipedia.org</a>'
},
accessibility: {
point: {
valueDescriptionFormat: '{point.x} kilometres, {value}.'
}
},
xAxis: {
tickmarkPlacement: 'on',
title: {
text: 'Height (km)'
},
accessibility: {
rangeDescription: 'Data ranges from 0 to 1000.'
}
},
yAxis: {
title: {
text: 'Volume fraction'
},
labels: {
format: '{value}%'
},
accessibility: {
rangeDescription: 'Data ranges from 0 to 100%.'
}
},
tooltip: {
shared: true,
headerFormat: null,
pointFormat: '<span style="color:{series.color}">{series.name}</span>: {point.y}<br/>',
valueSuffix: '%',
stickOnContact: true
},
plotOptions: {
areaspline: {
stacking: 'percent',
pointInterval: 100,
lineWidth: 1,
marker: {
enabled: false
},
label: {
style: {
fontSize: '16px',
opacity: 0.6
}
}
}
},
series: [
{
name: 'N₂',
color: '#a0d9ff',
data: [78, 76, 38, 10, 2.5, 0, 0, 0, 0, 0, 0]
},
{
name: 'O₂',
lineColor: '#3C5F7B',
data: [21, 20, 2, 0.5, 0, 0, 0, 0, 0, 0, 0]
},
{
name: 'O',
color: '#5891c8',
lineColor: '#34526A',
data: [0, 3, 59, 84, 70, 32, 8, 3, 1, 0, 0]
},
{
name: 'Ar',
color: '#346da4',
lineColor:...