10.06.2021, 06:30
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);
});
}
});
});