How to change color of values in Dashing list widget based on thresholds

1.5k Views Asked by At

I am using a dashing list widget to show some data. I want to be able to change color of values based on defined thresholds. Is there a way to do this?

1

There are 1 best solutions below

0
On

Add this to your widget coffee that you want to change the color

onData: (data) ->
 if data.status
   # clear existing "status-*" classes
   $(@get('node')).attr 'class', (i,c) ->
     c.replace /\bstatus-\S+/g, ''
   # add new class
   $(@get('node')).addClass "status-#{data.status}"

application.scss already has danger and warning colors.

In your .rb job file create your additional 'status' signal and tie it via status like this or whenever you want to change colors.

if value > 50 && value < 75
  status = 'warning'

send_event('event',  { value: value, status: status } )