Hey!
We truly hope that our free tool comes in handy for your business, especially these days. Follow our news, stay safe & pivot on!

How to do conditional formatting dynamically?

Answered

I have a requirement where user enters thresholds, currently I am able to  achieve using below : 

conditions: [
                {
                  formula: “#value >= 0”,
                  measure: “Time”,
                  format: {
                    “backgroundColor”: “#FFFFFF”,
                    “color”: “#303F9F”,
                    “fontFamily”: “Verdana”,
                    “fontSize”: “12px”
                  }
                }
              ],

 
Since these conditions/thresholds are stored in my Database, so is it possible to make them dynamic?
Note : I am using Angular 8 version.
2. Can I do conditional formatting based on two conditions – one is Calculated value and other from Non-Calculated parameter?
 
 
 
 

1 answer

WebDataRocks Team WebDataRocks September 24, 2020

Hello, Raj,
 
Thank you for writing to us.
 

  1. To set the conditions dynamically, please use setCondition() API call. We have prepared an example for illustration: https://codepen.io/webdatarocks/pen/BaKqLRL.
  2. We would like to confirm that it is possible. Please have a look at the example with two mentioned conditions added: https://codepen.io/webdatarocks/pen/ZEWqpyx.

 
Hope it helps.
 
Best regards,
WebDataRocks Team