Skip to content

Instantly share code, notes, and snippets.

@Kasahs
Last active December 8, 2015 14:48
Show Gist options
  • Save Kasahs/c5eb949c06e4c5bd6132 to your computer and use it in GitHub Desktop.
Save Kasahs/c5eb949c06e4c5bd6132 to your computer and use it in GitHub Desktop.
Highcharts stacked vertical column graph config.
<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; max-width: 800px; height: 400px; margin: 0 auto"></div>
$(function () {
$('#container').highcharts({
chart: {
type: 'column'
},
title: {
text: 'Stacked bar chart'
},
xAxis: {
categories: ['Week 1', 'Week 2', 'Last Week', 'This Week']
},
yAxis: {
min: 0,
title: {
text: 'Total fruit consumption'
}
},
legend: {
reversed: true
},
plotOptions: {
series: {
stacking: 'percent',
},
},
series: [{
name: 'Helpful',
color: '#90ED7D',
data: [35, 45, 30, 10]
}, {
name: 'Ok',
color: '#7CB5EC',
data: [45, 15, 40, 50]
}, {
name: 'Not Helpful',
color: '#434348',
data: [20, 40, 30, 40]
}]
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment