wildanSawaludin / flot

Automatically exported from code.google.com/p/flot
MIT License
0 stars 0 forks source link

flot development: tickDecimals seems broken #732

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
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 reported on code.google.com by tagliala...@gmail.com on 8 Aug 2012 at 7:33

GoogleCodeExporter commented 9 years ago
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:
https://github.com/flot/flot/pull/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

Original comment by sanak...@gmail.com on 10 Aug 2012 at 9:17