JSFiddle - React, Tailwind, and code Playground
by Danielle Parkinson
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; height: 400px; margin: 0 auto"></div>
JavaScript
$(function () {
$('#container').highcharts({
chart: {
type: 'bar',
height: 220,
width: 380
},
legend: {
itemStyle: {
color: '#2e2e2e',
fontSize: '13px',
fontFamily: 'Open Sans',
fontWeight: 'normal'
}
},
xAxis: {
categories: ['Norwegian Air', 'Jet2', 'Ryanair'],
labels: {
style: {
color: '#2e2e2e',
fontSize: '12px',
fontFamily: 'Open Sans'
}
},
},
yAxis: {
min: 0,
labels: {
style: {
color: '#2e2e2e',
fontSize: '12px',
fontFamily: 'Open Sans'
}
},
},
tooltip: {
pointFormat: '<span style="color:{series.color}">{series.name}</span>: <b>{point.y}</b> ({point.percentage:.0f}%)<br/>',
shared: true
},
plotOptions: {
bar: {
stacking: 'percent'
}
},
series: [{
color: '#ff7d00',
name: 'Better',
data: [75, 15, 10]
}, {
color: '#666',
name: 'Same',
data: [60, 25, 15]
}, {
color: '#ff4600',
name: 'Worse',
data: [55, 15, 30]
}]
});
});