format numbers in Javascript legend

Discussion created by mkaminow on Sep 12, 2013
Latest reply on Sep 16, 2013 by mkaminow
I am working on a web map based on the javascript sample here:

The numbers in my fields are all decimals with 1-2 decimal places, and the legend always adds extra zero's to the end. You can see this behavior in their live sample as well - select "Population/Square Mile(2007)" on the map at

I would like to round my number off and remove all the extra zero's, but I cannot figure out how. I tried modifying the script but I can't find a way to do it.  I rounded the number in the web service (I published the service so I can edit the original). I also tried to change the original field parameters to limit the number of decimals. I am stumped.

Coding is not my strong point.  Does anyone know of a way I can shorten the number of decimals to make the legend appear neater?