Skip to main content
ledi001
Associate III
Mar 6, 2021 1:37 PM UTC
Solved

How can i round the digits of a number?

Hi,

i am new with node-red functionality and i want to decrease the digits in a Gauge.

When i start the Dashboard i get the temperature in e.g. 21.77615442345 degrees. And i want to show it with 2 digits e.g. 21.78 degrees.

Ho can i do this?

This topic has been closed for replies.
ledi001
ledi001Best answer
Associate III
Mar 6, 2021 2:03 PM UTC

got it... :)

in the Gauge-node (Value format) type in {{value | number:2}}

will round the value by 2 digits.

2 replies

Uwe Bonnes
Chief
Mar 6, 2021 1:53 PM UTC

What produces the printout. Maybe some format string like %6.3f will help.

ledi001
ledi001AuthorBest answer
Associate III
Mar 6, 2021 2:03 PM UTC

got it... :)

in the Gauge-node (Value format) type in {{value | number:2}}

will round the value by 2 digits.