CSS
* {
font-family:
-apple-system,
BlinkMacSystemFont,
"Segoe UI",
Roboto,
Helvetica,
Arial,
"Apple Color Emoji",
"Segoe UI Emoji",
"Segoe UI Symbol",
sans-serif;
}
#container {
height: 400px;
}
.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 var(--highcharts-neutral-color-10, #e6e6e6);
margin: 10px auto;
text-align: center;
width: 100%;
max-width: 500px;
}
.highcharts-data-table caption {
padding: 1em 0;
font-size: 1.2em;
color: var(--highcharts-neutral-color-60, #666);
}
.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 tbody tr:nth-child(even) {
background: var(--highcharts-neutral-color-3, #f7f7f7);
}
.highcharts-description {
margin: 0.3rem 10px;
}
@media (prefers-color-scheme: dark) {
body {
background-color: #141414;
color: #ffffff;
}
}
JavaScript
// Retrieved from https://www.data.gouv.fr/datasets/donnees-climatologiques-de-base-quotidiennes/
Highcharts.chart('container', {
chart: {
type: 'areaspline'
},
title: {
text: 'Epaisseur de la neige en cm sur quatre saisons types'
},
subtitle: {
text: 'Source: <a href="https://www.data.gouv.fr/datasets/donnees-climatologiques-de-base-quotidiennes/" target="_blank">DataGouv</a>'
},
legend: {
layout: 'vertical',
align: 'left',
verticalAlign: 'top',
x: 120,
y: 70,
floating: true,
borderWidth: 1,
backgroundColor: 'var(--highcharts-background-color, #ffffff)'
},
xAxis: {
type: 'datetime',
tickInterval:30.41667 * 24 * 3600 * 1000,
labels: {
format: '{value:%B}'
},
dateTimeLabelFormats: {
// don't display the year
month: '%',
},
title: {
text: 'Date'
}
},
yAxis: {
title: {
text: 'L\'épaisseur de la neige a drastiquement diminué depuis 1974',
min: 0,
plotBands: [{
from: 0,
to: 20,
color: 'rgba(68, 170, 213, .2)'
}]
}
},
tooltip: {
headerFormat: '<b>{series.name}</b><br>',
pointFormat: '{point.x:%e. %b}: {point.y:.2f} cm'
},
credits: {
enabled: false
},
plotOptions: {
series: {
pointStart: 2000
},
areaspline: {
fillOpacity: 0.5
}
},
series: [{
name: 'Saison 1974-1975',
data:
[// NOV 74
['1974-11-01', 30.0],
['1974-11-02', 33.5],
['1974-11-03', 31.0],
['1974-11-04', 28.0],
['1974-11-05', 29.0],
['1974-11-06', 28.5],
['1974-11-07', 27.0],
['1974-11-08', 25.5],
['1974-11-09', 23.0],
['1974-11-10', 19.0],
['1974-11-11', 12.0],
['1974-11-12', 11.0],
['1974-11-13', 10.0],
['1974-11-14', 4.0],
['1974-11-15', 0.0],
['1974-11-16', 0.0],
['1974-11-17', 0.0],
['1974-11-18', 0.0],
['1974-11-19', 0.0],
['1974-11-20', 0.0],
['1974-11-21', 0.0],
['1974-11-22', 0.0],
['1974-11-23', 0.0],
['1974-11-24', 0.0],
['1974-11-25', 0.0],
['1974-11-26', 2.0],
['1974-11-27', 4.5],
['1974-11-28', 9.5],
['1974-11-29', 17.5],
['1974-11-30', 23.0],
//DEC 74
['1974-12-01', 17.0],
['1974-12-02',...