Opened 12 years ago
Closed 11 years ago
#9476 closed defect (fixed)
dojox.charting.plot2d.Pie._getLabel() makes use of Number.toFixed() which is broken in IE
Reported by: | Jared Jurkiewicz | Owned by: | Eugene Lazutkin |
---|---|---|---|
Priority: | high | Milestone: | 1.5 |
Component: | Charting | Version: | 1.2.3 |
Keywords: | Cc: | deanw | |
Blocked By: | Blocking: |
Description
Reported from a co-worker of mine:
The function dojox.charting.plot2d.Pie._getLabel() uses Number.toFixed() to round and stringify the number that is displayed as label next to the pie element.
Number.toFixed() is broken in Internet Explorer for numbers between 0.5 and 0.95 - in this case it returns 0 instead of 1.
Therefore the following alert would show 0:
var a = 0.921;
var b = 0;
alert(a.toFixed(b));
A workaround is to round the number using Math.round(). This would return 1:
alert((Math.round(Math.pow(10, b) * a) / Math.pow(10, b)).toFixed(b));
Change History (7)
comment:1 Changed 12 years ago by
comment:2 Changed 12 years ago by
probably a good idea to use dojo.number format also for i18n (proper decimal point, etc.)
comment:3 Changed 12 years ago by
Status: | new → assigned |
---|
dojo.number sounds right to me: l10n + one place to fix quirks..
comment:4 Changed 11 years ago by
Milestone: | tbd → 1.4 |
---|
comment:5 Changed 11 years ago by
Cc: | deanw added |
---|
comment:6 Changed 11 years ago by
Milestone: | 1.4 → 1.5 |
---|
bumping tickets that didn't make the 1.4 cut, but most likely to go in the next point release.
comment:7 Changed 11 years ago by
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
or use dojo.number.round (though you'd have to check back in 1.2 to see if this quirk was fixed back then) iirc, the IE bug is more extensive than this and comes up anytime the most significant digit is 5-9 in a number < 1.