Skip to content

Display ints as ints Issue 541 #57

Closed
wants to merge 1 commit into from

2 participants

@yaelelmatad

Fixed bug that displayed ints as floats when unnecessary.

Issue #541 on google code:
http://code.google.com/p/flot/issues/detail?can=2&q=541&colspec=ID%20Type%20Status%20Reporter%20Summary&id=541

@yaelelmatad yaelelmatad Dislay ints as ints Issue 541
Fixed bug that displayed ints as floats when unnecessary
4fe722a
@dnschnur
Flot member

I pulled your changes to my local repo for testing, and was surprised to find that I could no longer reproduce the original problem! After a little investigation I realized that pull request #50, which I just merged earlier today, had the unexpected side-effect of fixing this decimal issue.

It looks like the bug actually originates from floating point issues in JavaScript's toFixed, which is used in the default label formatter. Pull request #50 replaces it with a much faster alternative using Math.round, which happens to also avoid the problem entirely.

I did test your fix separately, and it doesn't appear to work, at least using the example provided by lizka in issue #541 on Chrome 20; the decimals still show up. Did you test against that example, or a different one?

In any case, I'm closing this pull request, since the issue is resolved. But I am thankful that you took the time to work on this; otherwise it might have been months before we realized that the problem was already solved, and it would have been very difficult at that point to figure out why.

@dnschnur dnschnur closed this Jul 11, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.