I have some issues with displaying numeric values in the main UI. While some values look nicely formatted others are shown with way to many decimal places (see screenshot)
The values are shown as text of an f7-chip component by accessing the state property of an item. I already tried to use displaystate instead and defined the corresponding metadata for the items. However that did not work reliably. Sometimes it was displayed correctly and sometimes no value at all. A refresh
Why are some values already formatted nicely without specifying any additional formatting hint and others not? Where is this configured?
I have at least one item that reproducible has no displayState property although the StateDescription Metadata is defined and is also respected when checking the item in the administrative UI for that item.
@crnjan has the explanation for why there isn’t always a displayState even when there is a State Description.
As for why some values appear formatted and others not? Have you looked to see what the state of the formatted ones are? I bet you’ll find that they match what is shown and don’t have as many decimal places. When ever you have a value that is the result of a calculation you will often have lots and lots of decimal places due to the fact that some numbers simply cannot be represented in a floating point number. Instead you end up with a value that’s really close which means lots of decimal places.