Accepted answer

The issue is the use of this.x here:

for (i = 0; i < 4; i++) {
    sum += series[i].yData[this.x];

For "normal" x-axis types this works well since you can open the yData by index. In your case it will end up trying to find something like series[0].yData[1262304000000], which won't work.

I'm not aware of any easy way to find the relationship between the timestamp this.x and which index that has on the x-axis. My solution uses another for loop to compare the timestamp from this.x with the xData array, and if it matches we use the data in the sum, as shown in this updated formatter:

formatter: function () {
    // If doing negative, ignore
    if( <= 0)

    var sum = 0;
    var series = this.axis.series;

    for (var i = 0; i < series.length; i++){
        for(var j = 0; j < series[i].xData.length; j++) {
            if(series[i].options.type == 'column' && series[i].xData[j] == this.x) {
                sum += series[i].yData[j];

    return sum;

This updated JSFiddle shows it in action.


If I understand what you're asking for correctly, the following formatter function should work:

        formatter: function () {
            return >= 0 ? : null ;

As to the available options in the formatter function, should help. But, I tend to just put a breakpoint in the function and inspect what this is. :)

Related Articles