10.06.2021, 06:31
(10.06.2021, 06:30)admin Wrote: Use this, make sure that all lower/upper limit objects are defined and they all follow the naming scheme as you've posted.
Code:$(function() {
$('.color-by-value').each(function(_, el) {
var addr = $(el).data('object');
if (addr) {
grp.listen(addr, function(obj) {
var value = obj.value;
var name = obj.name;
var color = 'green';
var lname = name.replace('ACTUAL_TEMP', 'LOWER_LIMIT');
var uname = name.replace('ACTUAL_TEMP', 'UPPER_LIMIT');
var llimit = grp.getvalue(lname);
var ulimit = grp.getvalue(uname);
if (value < llimit) {
color = 'blue';
}
else if (value > ulimit) {
color = 'red';
}
$(el).css('color', color);
});
}
});
});
Fantastic!
Will try this out during the day.
There are 10 kinds of people in the world; those who can read binary and those who don't