Highcharts Demo

author(s): Torstein Hønsi

by anikettiwari

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

JavaScript

Highcharts.chart('container', {
  chart: {
    type: 'column'
  },
  yAxis: {
    min: 0
  },
  tooltip: {
  	headerFormat: 'ss',
    pointFormatter: function(){
    	let result = 0;
    	for(let i=this.index; i>=0; i--){
      	result += this.series.chart.series[0].data[i].y;
      }
      return 'Actual value: ' + this.y + '<br> Running total: ' + result.toFixed(1)
    }
  },
  series: [{
    data: [49.9, 71.5, 106.4, 129.2, 144.0, 176.0, 135.6, 148.5, 216.4, 194.1, 95.6, 54.4]
  }]
});