JSFiddle - React, Tailwind, and code Playground
Stacked Bar
by David Hepworth
HTML
<script src="https://code.highcharts.com/highcharts.js"></script>
<script src="https://code.highcharts.com/modules/exporting.js"></script>
<div id="container" style="min-width: 310px; max-width: 800px; height: 400px; margin: 0 auto"></div>
JavaScript
Highcharts.chart('container', {
chart: {
type: 'bar'
},
title: {
text: 'Stacked bar chart'
},
xAxis: {
categories: ['2013', '2014', '2015', '2016', '2017']
},
yAxis: {
min: 0,
title: {
text: null
}
},
legend: {
reversed: true
},
plotOptions: {
series: {
stacking: 'normal'
}
},
series: [{
name: 'Injury',
data: [4, 9, 7, 12, 4]
}, {
name: 'Fire',
data: [4, 9, 10, 6, 2]
}, {
name: 'Release',
data: [7, 12, 11, 3, 2]
}, {
name: 'No Consequence',
data: [65, 113, 120, 131, 64]
}]
});