Column range
author(s):
Torstein Hønsi
HTML
<script src="https://code.highcharts.com/highcharts.js"></script>
<script src="https://code.highcharts.com/highcharts-more.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">
Chart showing ranges using horizontal columns. Each range is represented
with a low and high value, with a bar between them.
</p>
</figure>
CSS
body {
font-family:
-apple-system,
BlinkMacSystemFont,
"Segoe UI",
Roboto,
Helvetica,
Arial,
"Apple Color Emoji",
"Segoe UI Emoji",
"Segoe UI Symbol",
sans-serif;
background: var(--highcharts-background-color);
color: var(--highcharts-neutral-color-100);
}
.highcharts-figure,
.highcharts-data-table table {
min-width: 320px;
max-width: 800px;
margin: 1em auto;
}
#container {
height: 400px;
}
.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 {
background: light-dark(#f2f6f2, #323232);
border-radius: 0 4px 4px 0;
border-left: 2px solid light-dark(#1d6aff, #fff);
font-size: 0.8rem;
font-style: italic;
padding: 8px 16px;
margin: 2em 10px 1em;
}
JavaScript
Highcharts.chart('container', {
dataTable: {
columns: {
Month: [
'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun',
'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'
],
TempLow: [
-9.5, -7.8, -13.1, -4.4, -1.0, 3.1, 8.9, 9.6,
4.9, -5.2, -10.5, -12.1
],
TempHigh: [
8.0, 8.3, 9.2, 15.7, 20.8, 28.4, 27.0,
23.0, 19.3, 11.6, 12.0, 8.5
]
}
},
chart: {
type: 'columnrange',
inverted: true
},
accessibility: {
description: 'Image description: A column range chart compares the ' +
'monthly temperature variations throughout 2023 in Vik i Sogn, ' +
'Norway. The chart is interactive and displays the temperature ' +
'range for each month when hovering over the data. The ' +
'temperature is measured in degrees Celsius on the X-axis and ' +
'the months are plotted on the Y-axis. The lowest temperature is ' +
'recorded in March at minus 13.1 Celsius. The lowest range of ' +
'temperatures is found in September ranging from a low of 9.6 ' +
'to a high of 23.0 Celsius. The highest temperature is found in ' +
'June at 28.4 Celsius, and has the highest range of temperatures ' +
'from 3.1 up to 28.4'
},
title: {
text: 'Temperature variation by month'
},
subtitle: {
text: 'Observed in Vik i Sogn, Norway, 2023 | ' +
'Source: <a href="https://www.vikjavev.no/ver/" target="_blank">Vikjavev</a>'
},
xAxis: {
type: 'category'
},
yAxis: {
title: {
text: 'Temperature ( °C )'
}
},
tooltip: {
valueSuffix: '°C'
},
plotOptions: {
columnrange: {
borderRadius: '50%',
dataLabels: {
enabled: true,
...