Forum Discussion

duc_resolvevn's avatar
duc_resolvevn
Data Storage
02-18-2025
Solved

color-coded indicator icon

Dear DRay,   In Indicator widget document, I read that: "The Indicator widget provides various options for displaying one or two numeric values as a number, gauge or ticker. It also provides the op...
  • AssafHanina's avatar
    02-18-2025

    hey duc_resolvevn ,

    The Indicator Widget has a dedicated API, as provided in the following official link and examples shared in the following community post.

    please find a sample Indicator widget script of customizing the secondary indicator and add an arrow symbol. 

    widget.on('processresult', function(w, e) {
    
     var options = {
    
     secondaryValue: {
     fontFamily: 'Helvetica, sans-serif',
     fontWeight: 'bold',
     color: 'grey',
     fontSizes: {
     big: 20,
     medium: 15
     }
     }
     };
    
     
     if(e.result.secondary.data >= 0) {
     
     e.result.secondary.text = '▲' + e.result.secondary.text;
     options.secondaryValue.color = '#00FF00';
     
     
     }
     else {
     e.result.secondary.text = '▼' + e.result.secondary.text;
     options.secondaryValue.color = '#FF0000';
     }
     
     w.indicatorInstance.setOptions('numericSimple', options);
    
    });

    Alternative solution can be using Blox which provide ability to add more Indicators and customize it. 
    in the Blox Template, please refer to the Stock Market which provide an example with conditional formatting and image.

    FYI DRay 

    best regards