Basic column
author(s): Torstein Hønsi
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>
</figure>
CSS
.highcharts-figure, .highcharts-data-table table {
min-width: 310px;
max-width: 800px;
margin: 1em auto;
}
#container {
height: 400px;
}
.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: 'column',
},
title: {
text: 'HCC Score Trending',
align:'left'
},
exporting: {
enabled: false,
menuItems: null
},
scrollbar: {
enabled: true
},
credits: {
enabled: false
},
xAxis: {
title: {
text: 'Months'
},
min: 0,
max: 5,
categories: [
'Jan',
'Feb',
'Mar',
'Apr',
'May',
'Jun',
'Jul',
'Aug',
'Sep',
'Oct',
'Nov',
'Dec'
],
crosshair: true
},
yAxis: {
min: 0,
max: 0.6,
tickInterval: 0.1,
title: {
text: 'Score'
},
gridLineDashStyle: 'longdash',
},
tooltip: {
headerFormat: '<span style="font-size:10px">{point.key}</span><table>',
pointFormat: '<tr><td style="color:{series.color};padding:0">{series.name}: </td>' +
'<td style="padding:0"><b>{point.y:.1f} mm</b></td></tr>',
footerFormat: '</table>',
shared: true,
useHTML: true
},
plotOptions: {
column: {
pointPadding: 0.1,
borderWidth: 0
}
},
series: [{
name: '2016',
color:"#fdba4f",
data: [0.24,0.35,0.4,0.35,0.18,0.24,0.34,0.35,0.4,0.35,0.18,0.24]
}, {
name: '2017',
color:"#75b9cd",
data: [0.4,0.24,0.3,0.28,0.4,0.46,0.3,0.24,0.3,0.28,0.4,0.46]
}, {
name: '2018',
color:"#4d91c2",
data: [0.34,0.5,0.24,0.4,0.36,0.36,0.34,0.5,0.24,0.4,0.36,0.36]
}, {
name: '2019',
color:"#f57969",
data: [0.28,0.4,0.36,0.48,0.24,0.44,0.28,0.4,0.36,0.48,0.24,0.44]
}]
}, function(chart) { // on complete
function noop(){};
chart.renderer.button('<', chart.plotLeft -...