MindFreeze/ha-sankey-chart

Rounding to 0 decimals?

cromelex opened this issue · 3 comments

Hi,

I have my set up with round: 0, however I have some entities showing with a single decimal.

Some of my lights will report sometimes a residual 0.4W or 0.1W, I was hoping to dismiss them by using "round: 0", however it does not seem to be working? Ie, them keep showing on my chart despite the rounding being set to 0.

Thanks,

This is intentional, because of #18 . If they were rounded to 0 decimals, it would say 0W, and if it is 0, then it shouldn't be displayed and you would wonder where that 0.4 went. Or if it is displayed as 0W, you would wonder why it is displayed but other zero values are not. So for values that would round to zero we round to the first significant digit. Ex 0.0027 would show as 0.003

I have to add a note in the docs about this.

Thanks for the clarification, I understand now, seems logical.

I would recommend to do something like 0.0027 -> <0.01 (round to 2 dec). This limits the number of character. For instance 0.0000000027 will takes a huge among of space