This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm that you accept these cookies being set.

How change objects color at visu
#15
(30.01.2021, 11:07)khalil Wrote:
(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);
      });
    }
  });
});



thank you admin.
great job

Hello, I would like to use this example so that when a specific address is TRUE or FALSE
Reply


Messages In This Thread
How change objects color at visu - by AlexLV - 17.03.2019, 21:43
RE: How change objects color at visu - by davidchispas - 10.02.2021, 09:58

Forum Jump: