-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Tickformat "p" fix #3868
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Tickformat "p" fix #3868
Conversation
... as v1.1.0 is only compatible with karma-jasmine@2x
... so that it can benefit from the same rounding precision algo as 'regular' number formatting calls
Oh boy. Thanks for noticing that! |
For the lib.formatPercent = function(ratio, n) { n = n || 0; var str = (Math.round(100 * ratio * Math.pow(10, n)) * Math.pow(0.1, n)).toFixed(n) + '%'; for(var i = 0; i < n; i++) { if(str.indexOf('.') !== -1) { str = str.replace('0%', '%'); str = str.replace('.%', '%'); } } return str; }; |
@archmoj how do you compute the |
|
I'm having second thoughts about my attempt at fixing this bug. Closing for now. |
fixes #3814 and fixes a bad commit from #3867
before: https://codepen.io/jonmmease/pen/vMMNXJ?editors=1010
after:
https://codepen.io/etpinard/pen/NVpNEV?editors=1010https://codepen.io/etpinard/pen/yWbVqd?editors=1010cc @plotly/plotly_js