Perhaps I'm missing something, but it seems we need a way to define how many decimals places to show when averaging something out. Right now I'm averaging something and it's giving me 0.222222222222222. This is obnoxious and takes up a lot of room.
Isn't there a way to limit it to two decimal places?
Comments
Comment #1
Brentnauer commentedAm I the only one having this issue? If it's something I'm overlooking I'd appreciate someone telling me so :P Driving me crazy for weeks now.
Comment #2
Brentnauer commentedBump.
Anybody?
Comment #3
Brentnauer commentedIs anyone else even having this issue? What am I doing wrong? I've been looking for months now...
Comment #4
davedg629 commentedYea, for my averages I am getting 4 decimal places (e.g 1.5321)
Comment #5
davedg629 commentedCopy the view-calc-table.tpl.php file (found in the views_calc module folder) to your theme folder. Clear your cache (by going to admin/settings/performance and hitting the "clear cache" button). Your theme will now recognize this new template file.
You can now use the round() function to round the results down using the following code:
This will round all of the calculations to the nearest 100th (1.00). Lookup the round() php function on google to learn more about how to use it, its pretty easy (e.g. round($content, 0) will round 1.5432 to 2).
Comment #6
Brentnauer commentedYou are AMAZING. Thank you :)
Comment #7
Miguel.Andrade commentedYou will probably be better with something like:
So that labels don't disappear, spaces are not transformed to zeros, and if you use number_format you can even specify thousands and decimal separators.