Stacked column
author(s): Torstein Hønsi
by Sascha
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>
<script src="https://code.highcharts.com/modules/accessibility.js"></script>
<figure class="highcharts-figure">
<div id="container"></div>
<p class="highcharts-description">
Chart showing stacked columns for comparing quantities. Stacked charts
are often used to visualize data that accumulates to a sum. This chart
is showing data labels for each individual section of the stack.
</p>
</figure>
CSS
#container {
height: 400px;
}
.highcharts-figure, .highcharts-data-table table {
min-width: 310px;
max-width: 800px;
margin: 1em auto;
}
.highcharts-data-table table {
font-family: Verdana, sans-serif;
border-collapse: collapse;
border: 1px solid #EBEBEB;
margin: 10px auto;
text-align: center;
width: 100%;
max-width: 500px;
}
.highcharts-data-table caption {
padding: 1em 0;
font-size: 1.2em;
color: #555;
}
.highcharts-data-table th {
font-weight: 600;
padding: 0.5em;
}
.highcharts-data-table td, .highcharts-data-table th, .highcharts-data-table caption {
padding: 0.5em;
}
.highcharts-data-table thead tr, .highcharts-data-table tr:nth-child(even) {
background: #f8f8f8;
}
.highcharts-data-table tr:hover {
background: #f1f7ff;
}
JavaScript
Highcharts.chart('container', {
"colors": ["#FF6C00", "#A66999", "#0040FF", "#5CB85C", "#C5C5C5", "#FF5494"],
"chart": {
"backgroundColor": "transparent",
"spacing": 4,
"style": {
"fontFamily": "'Roboto', 'Helvetica', 'Arial', sans-serif"
},
"renderTo": "WP40_WAREHOUSE_OCCUPATION_TILE;_d703f811-8826-4f80-bd9c-572de6a28141rackFillLevelChart",
"zoomType": "x",
"panning": true,
"panKey": "shift",
"type": "column"
},
"plotOptions": {
"series": {
"borderWidth": 0,
"pointPadding": 0,
"groupPadding": 0.05,
"label": {
"style": {
"fontWeight": "normal"
}
},
"dataLabels": {
"style": {
"fontWeight": "bold"
}
},
"marker": {
"enabled": false
},
"stacking": "normal"
}
},
"legend": {
"margin": 2,
"enabled": true
},
"tooltip": {
"style": {
"borderRadius": 4
},
"useHTML": true,
"shared": true,
"split": false,
"outside": true,
"headerFormat": "<span style=\"font-size: 10px\">{point.key}</span><br/>"
},
"credits": {
"enabled": false
},
"exporting": {
"enabled": false
},
"title": {
"text": null,
"align": "left",
"style": {
"fontSize": "16px"
}
},
"boost": {
"useGPUTranslations": true,
"usePreallocated": true
},
"xAxis": {
"tickmarkPlacement": "on",
"labels": {
"autoRotation": [-10, -20, -30, -40, -50, -60, -70, -80, -90]
},
"title": {
"text": "Rack"
},
"visible": true,
"categories": ["045", "10A", "10B", "11A", "11B", "12A", "12B", "13A", "13B", "14A", "14B", "25A", "25B", "26A", "26B", "27A", "27B", "28A", "28B", "29A", "29B"]
},
"yAxis": [{
"title": {
"text": null
},
"visible": true,
"reversedStacks": false
}, {
"title": {
"text": null
},
"visible": true,
"opposite": true,
"max": 100,
// min: 0,
...