Stacked bar
author(s):
Torstein Hønsi
by Alagar Kamuthurai
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>
</figure>
JavaScript
// Data retrieved from: https://www.uefa.com/uefachampionsleague/history/
Highcharts.chart('container', {
chart: {
type: 'bar',
height:200
},
title: {
text: 'UEFA CL top scorers by season'
},
xAxis: {
enabled:false,
lineWidth: 0,
gridLineWidth: 0,
visible:false
},
yAxis: {
enabled:false,
lineWidth: 0,
gridLineWidth: 0,
visible:false
},
credits: {
enabled:false
},
legend: {
enabled:false
},
plotOptions: {
series: {
stacking: 'normal',
pointWidth: 30,
dataLabels: {
enabled: true,
verticalAlign: 'top',
align: 'left',
x: 0,
y: -20,
color: '#252525',
style: {
textShadow: false
},
formatter: function() {
return `${this.y}%`;
}
}
}
},
series: [{
name: 'Cristiano Ronaldo',
data: [4]
}, {
name: 'Lionel Messi',
data: [5]
}, {
name: 'Robert Lewandowski',
data: [5]
}]
});