Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

flot development: tickDecimals seems broken #811

Closed
dnschnur opened this Issue Sep 28, 2012 · 2 comments

Comments

Projects
None yet
1 participant
Owner

dnschnur commented Sep 28, 2012

Original author: tagliala...@gmail.com (August 08, 2012 19:33:09)

Hi, just updated flot to last development version from github.

I just noticed that tickDecimals seems don't work anymore. I had to add in my project:

  tickFormatter: (val, axis) ->
    val.toFixed(2)

reading the diff log, I found

  •                // spew out all possible ticks
    
  •                var start = floorInBase(axis.min, axis.tickSize),
    
  •                var ticks = [], start = floorInBase(axis.min, axis.tickSize),
    

maybe there is an issue?

Hope it helps

Best regards

GT

Original issue: http://code.google.com/p/flot/issues/detail?id=732

Owner

dnschnur commented Sep 28, 2012

From sanak...@gmail.com on August 10, 2012 21:17:43
Hi GT,

I just wanted to add to this issue. The likely cause for what you're seeing is the pull request from a month ago in which the performance of the default tickFormatter was changed from using toFixed() to a factor method.

This change also had the side effect of no longer displaying decimal precision in ticks which did not originally have decimal places (aka integers), despite axis.tickDecimals having the correct number of decimals during calculation. I'm not sure that it was intended though...

See:
#50

I posted the following comment on that pull request (for reference):


I'm curious... this pull request has both a performance benefit, and a behavioural side effect (as referenced in pull request #57 - issue 541).

Before: [0.0, 2.5, 5.0, 7.5, 10.0]
After: [0, 2.5, 5, 7.5, 10]

It seems like there is argument both to mirror precision if precision is detected, or ignore precision if a tick is an integer regardless of whether or not other ticks might have precision.

Perhaps there should be an option on the yaxis/xaxis to apply precision if detected? Also, would a better default be to mirror precision, or ignore precision on integers?

Cheers,

Jeff

@ghost ghost assigned dnschnur Nov 3, 2012

Owner

dnschnur commented Nov 22, 2012

This was unintentional; the formatter should always respect tickDecimals when it is specified. The default is (as introduced by #50) not to add precision to integers.

@dnschnur dnschnur closed this Nov 22, 2012

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment