Closed GoogleCodeExporter closed 8 years ago
Hi!
I think the problem here is your tickFormatter. Flot is rounding the float
values, but when you change them to strings in your formatter, you're probably
not doing anything special - and sometimes the values get rounded to something
very close to, but not exactly a round decimal number (this is a somewhat
surprising limitation of binary floating point numbers), which looks bad when
converted.
I discovered the exact same problem inside Flot when I designed the rounding
stuff, that's why the built-in number formatter is defined like this in the
Flot source:
function (v, axis) {
return v.toFixed(axis.tickDecimals);
}
And also why Flot goes to great lengths to try to compute a sensible value for
tickDecimals, since it can't rely on the runtime to do the right thing. Hope
this helps.
Original comment by olau%iol...@gtempaccount.com
on 23 Jun 2011 at 7:07
I had the same issue plotting big numbers, would write 3500000,
3749999.99999999999, ...
fixed by adding a tickFormatter:
yaxis: {
min: 3000000,
autoscaleMargin: .5,
tickFormatter: function suffixFormatter(val, axis) {
return (val.toFixed(0));
}
}
Original comment by aleck.la...@buildingenergy.com
on 14 May 2012 at 3:35
Original comment by dnsch...@gmail.com
on 4 Jun 2012 at 2:52
Original issue reported on code.google.com by
dqueve...@gmail.com
on 17 Jun 2011 at 2:18Attachments: