Open luc-pitipuis opened 9 years ago
Can you show what you're doing?
I just created a text widget that returned a value of 0 and it worked for me.
Ok, i read a json file containing that: { "Irregular": { "Total": 3, "Overdue": 0 }, "Operations": { "Total": 37, "Overdue": 16 } }
I define the number as text with sparkline:
and the result:
that's the result on chrome. On FF, the json is not parsed correctly... i will check if that could be the issue for chrome too.
Maybe try putting quotes around the numbers in the JSON.
Or in the value field, input a conditional statement that returns the string "0" to replace the number 0:
If (datasources[blah] == 0) return "0"; On Jan 29, 2015 8:19 PM, "Leon" notifications@github.com wrote:
Maybe try putting quotes around the numbers in the JSON.
— Reply to this email directly or view it on GitHub https://github.com/Freeboard/freeboard/issues/82#issuecomment-72137769.
Tried both solution, they both work, thank you @daleroy1 and @bugvish
However, I still think that it's a bug, except if somebody can explain what is the use case?
I'm prerty sure the JSON spec actually mentions needing quotes around all values from memory, even numbers. JavaScript in browsers just parses valued without quotes as numbers.
The spec does allow for it: http://json-schema.org/example1.html
And i don't output the json manually, it's converted from another datatype by the language standard function to do so :-/
In the end it's not so bad, I'm using freeboard as a PoC before developping something more fleshed out.
Hi guys. It seems that the text widget implementation has a bug when a '0' numeric value is rendered on screen using animation mode, because the implemented logic compares the last displayed value with the new one (in order to make it more efficient), but it isn't using a strict comparison, i.e., (undefined==0) => true. For that reason, the new numeric value (0) isn't rendered at page.
To fix it, open the "plugins/freeboard/freeboard.widget.js" file , go to line 18, and replace '==' with '===' (don't forget to update the minified version if you're using that file). Now, the renderer will do a right comparison, and the 0 value will be displayed.
Thanks to the "Bug Labs" team for this amazing open-source dashboard. We really love it!
Milko Madariaga.
I have seen this problem also. I was monitoring a weather station and often the windspeed was 0. The first few times it reported it was blank. Finally when it reported wind > 0 and then back to 0, it started showing 0's as normal.
@mmadaria, forgive the newbie question....but how/where do I modify the file you mentioned?
If you create a text widget and the value to display is the number zero, nothing will appears. However, if you have a non zero value, and after an update the value goes to zero, it is displayed.
I tried to fiddle with casting to force the text, with no luck.