score:2

Accepted answer

well, i can't tell you how to prevent the floating point error from occurring in the first place, but i can tell you how to hide it from the user.

you can simply use math.round() in your formatter function, as follows:

formatter: function() {
    return '<b>'+ this.point.name +'</b>: '+ math.round(this.percentage) +' %';
}

you already have a formatter function; i've just added math.round() to it.

i've updated your fiddle to demonstrate: http://jsfiddle.net/a2cve/1/

[edit] you mention that the tooltip was also showing the error. there is also a separate formatter function for that. i've updated the fiddle again with both formatter functions now edited to show the expected value: http://jsfiddle.net/a2cve/2/


Related Query

More Query from same tag