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; max-width: 800px; height: 400px; margin: 0 auto"></div>

JavaScript

Highcharts.chart('container', {
    chart: {
        type: 'bar'
    },
    title: {
        text: 'Energy output'
    },
    xAxis: {
        categories: ['January']
    },
    yAxis: {
        title: {
            text: 'MWh'
        }
    },
    legend: {
        reversed: true
    },
    plotOptions: {
        series: {
            stacking: 'normal'
        }
    },
    series: [{
        name: 'Imoport to grid',
        data: [-5]
    },
    {
        name: 'Consumption',
        data: [-10]
    },
    
    {
        name: 'Export to grid',
        data: [2]
    }, {
        name: 'Production',
        data: [13]
    }]
});