score:10

Accepted answer

This case you can get the max by the following line:
this.axis.max;

So your function should be:

formatter: function() {
    var maxElement = this.axis.max;
    if (maxElement > gb) {
        return (this.value / gb).toFixed(1) + " GB";
    } else if (maxElement > mb) {
        return (this.value / mb).toFixed(1) + " MB";
    } else if (maxElement > kb) {
        return (this.value / kb).toFixed(1) + " KB";
    } else {
        return (this.value) + " B";
    }
}​

You can see it working here.


Related Query

More Query from same tag