cancel
Showing results for 
Search instead for 
Did you mean: 
intapiuser
Community Team Member
Community Team Member
Introduction
Sometimes you might want to change the color the rows of your pivot based on a numeric condition - for example coloring the row in green if the revenue is over or equal to a certain value, and red if it's below it:
Steps

STEP 1 - ADD THE FOLLOWING SCRIPT TO YOUR PIVOT'S EDIT SCRIPT

var condition_number = ;
var color_up = "#339933";
var color_down = "#ff6666";
widget.on('ready', function(){
setTimeout(function(){
$("tbody tr", element).each(function(){
if(parseInt($(this).children(".p-value").children().text().replace(',','')) >= condition_number){
$(this).css("background-color", color_up);
}
else {
$(this).css("background-color", color_down);
}
$(this).children().last().remove();
});
$(".p-alternate").removeClass("p-alternate");
//$(".phantom").remove();
}, 1)
});

STEP 2 - SET CONDITION_NUMBER TO THE DESIRED VALUE

STEP 3 - SAVE THE SCRIPT, REFRESH THE WIDGET AND CLICK "APPLY"

*You can change the colors of the conditional by changing the values of color_up and color_down
Rate this article:
Version history
Last update:
‎02-05-2024 10:10 AM
Updated by: