Highcharts Demo
author(s): Torstein Hønsi
by muris2016
HTML
<script src="https://code.highcharts.com/highcharts.js"></script>
<script src="https://code.highcharts.com/modules/exporting.js"></script>
<script src="https://code.highcharts.com/modules/export-data.js"></script>
<div id="container" style="min-width: 310px; height: 400px; margin: 0 auto"></div>
JavaScript
Highcharts.chart('container', {
chart: {
type: 'column'
},
title: {
text: 'Stacked column chart'
},
xAxis: {
categories: ['Staff', 'Leader', 'Manager', 'Senior Manager', 'Director', 'Executive Director']
},
yAxis: {
min: 0,
title: {
text: 'Total fruit consumption'
},
stackLabels: {
enabled: true,
style: {
fontWeight: 'bold',
color: ( // theme
Highcharts.defaultOptions.title.style &&
Highcharts.defaultOptions.title.style.color
) || 'gray'
}
}
},
legend: {
align: 'right',
x: -30,
verticalAlign: 'top',
y: 25,
floating: true,
backgroundColor:
Highcharts.defaultOptions.legend.backgroundColor || 'white',
borderColor: '#CCC',
borderWidth: 1,
shadow: false
},
tooltip: {
headerFormat: '<b>{point.x}</b><br/>',
pointFormat: '{series.name}: {point.y}<br/>Total: {point.stackTotal}'
},
plotOptions: {
column: {
stacking: 'normal',
dataLabels: {
enabled: true
}
}
},
colors: ['#9AAE04', '#707372', '#6785C1', '#643269', '#960F68', '#D76734', '#E39F03', '#DDB322', '#798D44',
'#339966', '#205390', '#1994A4'],
series: [{
name: 'Baja no deseada',
data: [8, 8, 1, 1, ]
}, {
name: 'Baja deseada',
data: [3, 3, 1, 1, ]
}, {
name: 'Excedencia voluntaria',
data: [0, 0, 1, 0, 0]
}]
});