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 Query

More Query from same tag