Waterfall

author(s): Torstein Hønsi

by Saibabu Boddeda

HTML

<script src="https://code.jquery.com/jquery-3.1.1.min.js"></script>
<script src="https://code.highcharts.com/highcharts.js"></script>
<script src="https://code.highcharts.com/highcharts-more.js"></script>
<script src="https://code.highcharts.com/modules/exporting.js"></script>

<div id="container" style="min-width: 310px; max-width: 600px; height: 400px; margin: 0 auto"></div>

JavaScript

Highcharts.chart('container', {
    chart: {
        type: 'waterfall'
    },

    title: {
        text: 'Highcharts Waterfall'
    },

    xAxis: {
        type: 'category',
        tickWidth: 1,
        tickLength: 30
    },

    yAxis: {
        title: {
            text: 'USD'
        }
    },

    legend: {
        enabled: false
    },

    tooltip: {
        pointFormat: '<b>${point.y:,.2f}</b> USD'
    },

    series: [{
        upColor: 'green',
        color: 'red',
        data: [{
            name: 'a',
            y: 60
        }, {
            name: 'b',
            y: 100
        }, {
            name: 'c',
            y: 50
        }, {
            name: 'd',
            isIntermediateSum: true,
            color: 'blue'
        }, {
            name: 'e',
            y: -20
        }, {
            name: 'f',
            y: -80
        }, {
            name: 'h',
            isSum: true,
            color: 'yellow'
        }],
        dataLabels: {
            enabled: true
        },
        pointPadding: 0
    }]
});