forio / contour

Apache License 2.0
120 stars 21 forks source link

Y-axis tick values are not always nicely generated #298

Open lukwallace opened 5 years ago

lukwallace commented 5 years ago

yAxis tick value generation uses a niceTicks function that seems to generate some not so nice ticks on certain datasets:

_.nw.niceTicks(-16575919.58, 0, undefined)
//  creates [-16575919.6, -12575919.6, -8575919.6, -4575919.6, -575919.6, 3424080.4]

Found while testing with data set: [-16575919.58, 0, 0, 0]

safetybelt commented 1 year ago

This is true of small datasets as well:

 _.nw.niceTicks(0, 0.022, undefined) 
// creates [0, 0, 0, 0, 0]

We also have a report of issues with large datasets, but I'm unable to reproduce. This is what the user reported: image

After investigation, the labels were essentially floating point bugs where the label would want to be 1000000.0000000000000002 and would get changed to 1.0000000000000002M.

We should investigate if it's possible using niceTicks or if they were overwriting the formatter (or similar).