JSFiddle - React, Tailwind, and code Playground
by Sanjay
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
$(function () {
$('#container').highcharts({
chart: {
type: 'bar'
},
title: {
text: 'Stacked bar chart'
},
xAxis: {
type: 'category',
},
yAxis: {
min: 0,
title: {
text: 'Total fruit consumption'
}
},
legend: {
reversed: true
},
plotOptions: {
series: {
stacking: 'normal'
}
},
series: [{
name: 'John',
data: [{name: 'Apple', y: 7}, {name: 'Orange', y: 3}, {name: 'Pears', y: 4}]
}, {
name: 'Jane',
data: [{name: 'Apple', y:2}, {name:'Orange',y:1}, {name:'Pears',y:3}]
}, {
name: 'Joe',
data: [{name:'Apple',y:0}, {name:'Orange',y:4}, {name:'Pears',y:3}]
}]
});
});