Opened 11 years ago

Closed 11 years ago

#1747 closed enhancement (fixed)

Change the meaning of 'Decimals' setting to 'Precision'

Reported by: Nicklas Nordborg Owned by: everyone
Priority: minor Milestone: BASE 3.2.2
Component: web Version:
Keywords: Cc:

Description

There is a global setting for the number of decimals to display in the BASE web client in the BASE->Preferences dialog. The default number is 2 and it makes sense in a lot of places since values are normally in the 1-100 range.

For very large or small values the setting can be irritating. For example, original sample quantities can be several hundred milli-grams in size and when that value is displayed in µg using 2 decimal points it becomes almost ridiculous (eg. 118000.00 µg). In the other end, after extraction the remaining DNA/RNA may be only a few nano-grams and the value is then rounded so that almost nothing is displayed (eg. 0.01 µg when the actual value is 11.5 ng). Since all values between 5.1 ng and 14.9 ng are rounded to 0.01 µg the only solution is currently to increase the number of decimals (thanks to #1746) which makes the original sample quantities display even more ridiculous.

The idea is to change the 'Decimals' setting to mean 'Precision' instead so that the number of decimals to display depends on the order of magnitude of the value. We could define the precision to mean the number of decimals to use when the value is in the range 1-10 and then add or remove decimals if the value is lower or higher.

For example, if the precision is 3 the following scheme is used:

Value range Decimals
0-0.01 6
0.01-0.1 5
0.1 - 1 4
1-10 3
10-100 2
100-1000 1
1000- 0

Change History (1)

comment:1 by Nicklas Nordborg, 11 years ago

Resolution: fixed
Status: newclosed

(In [6252]) Fixes #1747: Change the meaning of 'Decimals' setting to 'Precision'

Added AdaptiveNumberFormatter implementation that dynamically calculates the number of decimals to use. The FormatterFactory implementation now uses the new formatter instead of the old one.

Also changed the formatting original and remaining quantity display on a several places to use a Formatter implementation (eg. a better fix for #1746) so now the setting should automatically be applied everywhere numbers are displayed. The only exception is file sizes which now always use 2 decimals and dynamic switching between kb, Mb and Gb (this was not consistent before).

Note: See TracTickets for help on using tickets.