10.06.2021, 06:01
(29.01.2021, 08:03)admin Wrote: Full example, additional class is color-by-value. It changes text color depending on current value but any other CSS property can be changed this way.
Code:$(function() { $('.color-by-value').each(function(_, el) { var addr = $(el).data('object'); if (addr) { grp.listen(addr, function(obj) { var value = obj.value , color = 'blue'; // default color if (value >= 0 && value <= 6) { color = 'red'; } else if (value > 6) { color = 'green'; } $(el).css('color', color); }); } }); });
I am trying this solution too, but with no luck.
I have copied the code above to CSS and added the additional class to the object, but the color of the text does not change. If I change the text in the browser console, it changes in the visualisation as well.
Any idea what other things one might need to do? I have created a temperature object with this additional class as my first test.
There are 10 kinds of people in the world; those who can read binary and those who don't