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>
https://jsfiddle.net/maxi_mizer/w8ka7wun/#run

JavaScript

var tab = [233.967,
1281.065,
99.098,
5807.416,
993.995
]

var names =['Biogas',
'Biomass',
'Solar',
'Wind',
'Water']



Highcharts.chart('container', {
colors: ['#029676', '#c0cf3a', '#8ab833', '#549e39', '#bbc3bd', '#8f9191', '#e3ded1'],
    chart: {
        type: 'column'
    },
    title: {
        text: 'OZE production in Poland in 2016'
    },
    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: [names[4]],
        data: [tab[4]]
    }   ,
{
        name: [names[3]],
        data: [tab[3]]
    }   ,
    {
        name:[names[2]],
        data: [tab[2]]
    },
    
    {
        name: [names[1]],
        data: [tab[1]],

    }, {
        name: [names[0]],
        data: [tab[0]]
    }
    
    ]
});