JSFiddle - React, Tailwind, and code Playground
HTML
<script src="http://code.highcharts.com/highcharts.js"></script>
<script src="http://code.highcharts.com/modules/exporting.js"></script>
<div id="container" style="min-width: 310px; height: 400px; margin: 0 auto"></div>
JavaScript
$(function () {
var sections = ['G','S','R','O','F'];
$('#container').highcharts({
chart: {
type: 'bar'
},
title: {
text: 'Stacked bar chart'
},
xAxis: {
categories: ['Goals', 'Self-Assessment', 'Review', 'Objective', 'Feedback Summary']
},
yAxis: {
min: 0,
title: {
text: 'Answered'
}
},
legend: {
backgroundColor: '#FFFFFF',
reversed: true
},
plotOptions: {
series: {
stacking: 'normal',
point: {
events: {
click : function() {
// Don't pass a dumb data structure(ordinal X)
// Pass a smarter data structure, something that has a semantics upfront
alert(sections[this.x]);
// http://stackoverflow.com/questions/2953867/example-of-eric-raymonds-smart-data-structures-principle/2953906#2953906
}
}
}
}
},
series: [{
name: 'John',
data: [5, 3, 4, 7, 2]
}, {
name: 'Jane',
data: [2, 2, 3, 2, 1]
}, {
name: 'Joe',
data: [3, 4, 4, 2, 5]
}]
});
});