Request: Conditional Formatting on Indicator Background

Comments

2 comments

  • Avatar
    Andrew Block (Edited )

    Chris not sure what version you are on but this should work:

    widget.on('ready', function(se, ev){
    $(element).css('background-color','#628687'); //changes the widget's background
    })

     

    edit: sorry just noticed now that you wanted this to be conditional based

  • Avatar
    Lidor Rosencovich (Edited )

    Hi Chris,

    In case you are using Sisense 6.7 which supports the new indicator styling API, you can read this documentation on how to use it. Instead of doing this in the 'initialized' event, you can apply it in the 'processresult' event where you will have the results already, and then apply your styling according to.

    here is an example:

    widget.on('processresult', function(w, args) {

    var options = {
    title: {
    color: 'red',
    },
    bracketColor: 'yellow'
    };

    if (args.result.value.data > 1000){

        options.title.color = 'blue'

    }


    w.indicatorInstance.setOptions('numericBar', options);
    });

     

    In case you are using an older version with the old indicator, you can do this on the 'ready' event and just grab the element using jQuery and apply the right CSS to you desired sub-element.

    for example: 

    widget.on('ready', function(w, args) {



    if (args.widget.result.value.data > 1000){

        $(element).css('background-color','#628687'); //changes the widget's background

    }
    });

    Please note that in the new indicator it's not supported to change the indicator's background itself but the element that wraps it - since it's on Canvas.

     

    Hope it answers your question.

    Regards,

    Lidor

     

Please sign in to leave a comment.