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 option to add additional titles and a color-coded indicator icon representing the value, such as a green up arrow or a red down arrow."

Can you please help me how to add "a color-coded indicator icon representing the value, such as a green up arrow or a red down arrow", I need to create a widget as in attachment.

Thanks

  • 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

2 Replies

  • AssafHanina's avatar
    AssafHanina
    Sisense Employee

    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

  • Tks AssafHanina , with your reply I understand that we don't have "no code" options for my question. When I read document I though widget prodvide "no code" option, we will try with edit script or blox.