JSFiddle - React, Tailwind, and code Playground
by koh_edwin
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 () {
var colors = ["red", "blue","green","yellow"]; //Highcharts.getOptions().colors.slice(0),
dark = -0.5;
// colors[1] = "black";//Highcharts.Color(colors[0]).brighten(dark).get();
//colors[3] = "red";//Highcharts.Color(colors[2]).brighten(dark).get();
console.log('colors',JSON.stringify(colors));
console.log('colors',JSON.stringify(colors[1]));
console.log('colors',JSON.stringify(colors[3]));
$('#container').highcharts({
chart: {
type: 'column'
},
colors: colors,
title: {
text: 'Total fruit consumtion, grouped by Actual vs Budget'
},
xAxis: {
categories: ['Apples', 'Oranges', 'Pears', 'Grapes', 'Bananas']
},
yAxis: {
allowDecimals: false,
min: 0,
title: {
text: 'Number of fruits'
}
},
tooltip: {
formatter: function () {
return '<b>' + this.x + '</b><br/>' +
this.series.name + " - " + this.series.options.stack + ': ' + this.y + '<br/>' +
'Total: ' + this.point.stackTotal;
}
},
plotOptions: {
column: {
stacking: 'normal'
}
},
series: [{
name: 'John',
data: [5, 3, 4, 7, 2],
stack: 'Actual'
}, {
name: 'John',
data: [3, 4, 4, 2, 5],
stack: 'Budget'
}, {
name: 'Jane',
data: [2, 5, 6, 2, 1],
stack: 'Actual'
}, {
name: 'Jane',
data: [3, 0, 4, 4, 3],
stack: 'Budget'
}]
});
});