cancel
Showing results for 
Search instead for 
Did you mean: 
intapiuser
Community Team Member
Community Team Member

Overview

In this example the script goes through the pivot line by line and when it finds "Female" it colors the entire line light pink, its associated key pair value. It does the same for the word "Male" and colors the record light blue.
Normally, you would only be able to conditionally format the value's box on the value itself, not the dimension.

Technical Overview

The colorMap object contains a key value pairing of a string and an associated color.
Set the strings you want to search for on the left as keys and the colors you want to format them as values on the right.
Make sure to keep track of your comma and quotation usage.

// edit colorMap values below
var colorMap = {
   "Female" :"lightpink",
   "Male" :"lightblue"
}

// don't edit below!
widget.on('ready', function (a, b){
   $.each(colorMap, function(k,v){
      $('#pivot_ tr:contains(' + k +')', element).css('background-color', v);
   })
});
Rate this article:
Version history
Last update:
‎03-02-2023 09:08 AM
Updated by:
Contributors