Highcharts Demo
author(s):
Torstein Hønsi
by Joanna Sobańska
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: 800px; margin: 0 auto"></div>
JavaScript
var tab = [8622,2439,6004,1]
Highcharts.chart('container', {
colors: ['#029676', '#c0cf3a', '#8ab833', '#549e39', '#bbc3bd', '#8f9191', '#e3ded1'],
chart: {
type: 'column'
},
title: {
text: 'Electricity production by sources in Poland in 2015'
},
xAxis: {
categories: ['']
},
yAxis: {
min: 0,
title: {
text: '[%]'
},
stackLabels: {
enabled: true,
style: {
fontWeight: 'bold',
color: (Highcharts.theme && Highcharts.theme.textColor) || 'gray'
}
}
},
tooltip: {
headerFormat: '<b>{point.x}</b><br/>',
pointFormat: '{series.name}: {point.y}<br/>Total: {point.stackTotal}'
},
plotOptions: {
column: {
stacking: 'percent',
dataLabels: {
enabled: true,
color: (Highcharts.theme && Highcharts.theme.dataLabelsColor) || 'white'
}
}
},
series: [
{
name: 'PV',
data: [tab[3]]
} ,
{
name: 'Wind',
data: [tab[2]]
},
{
name: 'water',
data: [tab[1]],
}, {
name: 'Biomass and Biogas',
data: [tab[0]]
}
]
});