Forum Discussion

Lisha's avatar
Lisha
Cloud Apps
10-17-2022

Widget refresh

Hello,

I have added a widget script which performs my required action and at the end I want to refresh the widget.

Everything is working fine but the widget keeps on refreshing again and again. Is there a way to limit this so the widget is refreshed only once after the result is processed.

Below is the structure of the script used :

widget.on('processresult', function(widget, query) {

. .

. . 

. . 
widget.refresh();
});

 

3 Replies

Replies have been turned off for this discussion
  • Harry's avatar
    Harry
    Cloud Apps

    Hello Lisha ,

    The 'processresult' event executes before the chart renders. So normally refresh is does not required in this event. Can you explain what action you are performing in 'processresult' event?

    Always here to help,
    Harry from QBeeQ
    [email protected]
    www.qbeeq.pl

    • Lisha's avatar
      Lisha
      Cloud Apps

      Hi Harry 

      I am changing the indicator color based on some specific conditions.

      This has to be done using a script (and not via provided color formatting within widget) since it is a complex logic.  

  • Harry's avatar
    Harry
    Cloud Apps

    Try below script to change color

    ev.result.gauge.color = 'green'

    Example:

    
    widget.on('processresult',function(se, ev){
    
      var value = 5
      
      if(value > 5 )
      	ev.result.gauge.color = 'green'
      else 
    	ev.result.gauge.color = 'red'
    })

    Always here to help,
    Harry from QBeeQ
    [email protected]
    www.qbeeq.pl