Add a decimal settings to the embed Gauge widget?

Hello everyone.

A customer of mine uses the embed gauge widget to retrieve a weight value from a scale. Even after calling ROUND() in an expression to limit the value to 3 decimals, the gauge displays a very wide value, something like 1.23400000005.

I suspect that ROUND() does its job but as usual, floating point values cannot be exactly represented in a computer. The gauge widget seems to display the raw value (the closest value to the rounded one that the computer can represent, but not the exact one which will remain unreachable most of the time).

Long story short (those are not actual float values ; I invented some to illustrate my point):

  • Stored raw float value returned by the scale: 1.233873632463
  • Stored raw float value after calling ROUND() for 3-decimal rounding: 1.23400000005
  • Desired value (cannot be directly stored in the computer but can be displayed with 3 decimals after using a formatting function): 1.234

For obvious UX reasons, it would be preferable to display 1.234. We can currently control the gauge’s range (min and max). I suggest that an integral Decimals parameter is added to control the number of decimals actually displayed by the gauge.