Here's a solution that uses suffixes for large numbers while keeping the accuracy:
function tick_label(val) {
if (val < 0) return "\u2212" + tick_label(-val);
if (val < 1000) return String(val);
var mag = 1;
var suffix = "";
if (val >= 1000) { mag = 1000; suffix = "k" }
if (val >= 1000000) { mag = 1000000; suffix = "M" }
if (val >= 1000000000) { mag = 1000000000; suffix = "G" }
var div = mag;
while (val % 10 == 0) {
val /= 10;
div /= 10;
}
return String(val / div) + suffix;
}
This code relies on round numbers for ticks, so that the exact number doesn't look strange or overly exact. (A scale of 1.002k, 1.004k, 1.006k looks okay, but a scale of 1.102k, 1.202k, 1.302k does not. I'm not familiar with Flot, but I guess it takes care of that.)