Waterfall chart legend

by amrutaJgtp

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'
  },

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

  legend: {
    enabled: true
  },

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

  plotOptions: {
    series: {
      showInLegend: true
    }
  },

  series: [{
    name: 'Rise',
    color: 'rgb(65, 50, 155)'
  }, {
    upColor: 'rgb(65, 50, 155)',
    color: 'rgba(180,211,51,1)',
    pointWidth: 42,
    name: 'Fall',
    data: [{
      name: 'Start',
      y: 120000
    }, {
      name: 'Product Revenue',
      y: 569000
    }, {
      name: 'Service Revenue',
      y: 231000
    }, {
      name: 'Fixed Costs',
      y: -342000
    }, {
      name: 'Variable Costs',
      y: -233000
    }, {
      name: 'Balance',
      color: 'rgba(255,211,0,1)',
      isSum: true
    }],
    dataLabels: {
      enabled: true,
      formatter: function() {
        return Highcharts.numberFormat(this.y / 1000, 0, ',') + 'k';
      },
      style: {
        fontWeight: 'bold'
      }
    },
    pointPadding: 0
  }, {
    name: 'Grand total',
    color: 'rgba(255,211,0,1)',
    type: 'area'
  }]
});