JSFiddle - React, Tailwind, and code Playground
Highcharts Demo: Bar Chart
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"></div>
CSS
/* .highcharts-root rect.highcharts-background {
fill: transparent;
} */
#container {
min-width: 310px;
max-width: 800px;
height: 400px;
margin: 0 auto
}
JavaScript
Highcharts.chart('container', {
chart: {
type: 'bar'
},
responsive: true,
backgroundColor: null,
title: {
text: null
},
xAxis: {
categories: ['Confined Space', 'Falls & Dropped Objects', 'Assess & Mitigate Hazards', 'Control Hazardous Energy', 'Vehicle & Equipment Operations', 'Lifting & Rigging', 'Excavations', 'Verify Lineup/Containment', 'Maintain Safety Sytems'],
title: {
text: null
},
labels:{
align:'left',
x:3,
y:-15,
style: {
width: '100%',
'min-width': '250px'
},
useHTML: true
}
},
yAxis: {
gridLineWidth: 0,
minorGridLineWidth: 0,
min: 0,
title: {
text: null,
align: 'high'
},
labels: {
overflow: 'justify',
enabled: false
}
},
tooltip: {
valueSuffix: ' millions'
},
plotOptions: {
bar: {
dataLabels: {
inside: false,
enabled: true
}
}
},
legend: {
layout: 'vertical',
align: 'right',
verticalAlign: 'top',
x: -40,
y: 80,
enabled: false,
floating: true,
borderWidth: 1,
backgroundColor: ((Highcharts.theme && Highcharts.theme.legendBackgroundColor) || '#FFFFFF'),
shadow: true
},
credits: {
enabled: false
},
series: [{
data: [1, 15, 14, 14, 6, 5, 3, 3, 2]
}]
});