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 = [17066,558,3968,5247,56150,81568]

Highcharts.chart('container', {
colors: ['#029676', '#c0cf3a', '#8ab833', '#549e39', '#bbc3bd', '#8f9191', '#e3ded1'],
    chart: {
        type: 'column'
    },
    title: {
        text: 'Produkcja energii elektrycznej według nośników 2013'
    },
    xAxis: {
        categories: ['']
    },
    yAxis: {
        min: 0,
        title: {
            text: '[GW]'
        },
        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: 'Coal',
        data: [tab[0]],

    }, {
        name: 'Lignite',
        data: [tab[1]],
    }, {
        name: 'Gas',
        data: [tab[2]]
    }
    , {
        name: 'Gas',
        data: [tab[2]],
    }    , 
    {
        name: 'Others',
        data: [tab[3]],
    },
    {
        name: 'Pumped Water',
        data: [tab[4]],
    },
   {
        name: 'OZE',
        data: [tab[5]]
    }
    
    ]
});