Very similar to the question stated in the problem blow, I want to automatically show big numbers using k, M etc. (1200 => 1.2k).
highcharts tooltip format millions billions
This seems to work for standard Highcharts plots but not for Highstock plots. My guess is that this is due to Highstock not having yAxis?
See, e.g., http://jsfiddle.net/1zhga6bm/1/
Would anyone know how to adjust the code below so that it works in Highstock?
var chart = new Highcharts.StockChart({
chart: {
renderTo: 'container'
},
series: [{
name: 'USD to EUR',
data: [10000, 1000000]
}],
tooltip: {
valueSuffix: '',
formatter: function () {
var ret = '',
multi,
axis = this.series.yAxis,
numericSymbols = ['k', 'M', 'G', 'T', 'P', 'E'],
i = numericSymbols.length;
while (i-- && ret === '') {
multi = Math.pow(1000, i + 1);
if (axis.tickInterval >= multi && numericSymbols[i] !== null) {
ret = Highcharts.numberFormat(this.y / multi, -1) + numericSymbols[i];
}
}
return ret;
}
}
});
Adjusted JSfiddle from below comment.
Many thanks!