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: 400px; height: 400px; margin: 0 auto"></div>
CSS
body {
background: grey;
}
.middle {
display:inline-block;
text-align: center;
width: 100%;
}
JavaScript
$(function () {
(function (H) {
var UNDEFINED;
/**
* Returns true if the object is not null or undefined. Like MooTools' $.defined.
* @param {Object} obj
*/
function defined(obj) {
return obj !== UNDEFINED && obj !== null;
}
H.wrap(H.Legend.prototype, 'getAllItems', function (p) {
var allItems = [],
pointsForLegend = [];
H.each(this.chart.series, function (series) {
var seriesOptions = series.options;
// Handle showInLegend. If the series is linked to another series, defaults to false.
if (!H.pick(seriesOptions.showInLegend, !defined(seriesOptions.linkedTo) ? UNDEFINED : false, true)) {
return;
}
if (series.legendItems) {
// use points or series for the legend item depending on legendType
allItems = allItems.concat(series.legendItems);
} else if (seriesOptions.legendType === 'point') {
H.each(series.data, function (e, i) {
if (e.showInLegend) {
pointsForLegend.push(e);
}
})
allItems = allItems.concat(pointsForLegend);
} else {
allItems = allItems.concat(series);
}
});
return allItems;
});
})(Highcharts);
var colors = Highcharts.getOptions().colors,
categories = ['Category A', 'Category B'],
name = 'Browser brands',
innerColors = ['white', 'white'],
color = ['Red', 'Green', 'Yellow'],
data = [{
y: 60,
color: colors[5],
drilldown: {
name: 'Category A',
categories: ['High', 'Low', 'Medium'],
data: [10, 20, 30]
}
}, {
...