cancel
Showing results for 
Search instead for 
Did you mean: 
OleksandrB
Sisense Team Member
Sisense Team Member

Change the background color of the Pivot cell on value Windows

If you want to change the background color for categories on value, like in the picture below

Screenshot_87.png

 
You can use such a script:

 

var columns = [2]; //select the date columns that should be transformed

widget.on('ready', function (se, ev) {
	$.each(columns, function (index, value) {
		var num = $("tbody tr:first", element).children().length - value;

		$("tbody tr", element).not('.wrapper, .p-head-content').each(function () {
			var cell = $(this).children().last();
			for (var a = 0; a < num; a++) {
				cell = cell.prev();
			}

			var cell_value = cell.text()
// change the values and color below
			if (cell_value.includes('Male')) {
				$(cell).css("background-color", 'red');
			} else if (cell_value.includes('Female')) {
				$(cell).css("background-color", 'yellow');
			}else if (cell_value.includes('Unspecified')) {
				$(cell).css("background-color", 'white');
			}
		});
	});
});

 


For your Pivot widget, press the Edit button in the upper right corner of the widget (pencil icon), press the three dots in the upper right corner, select Edit Script from the menu, and paste the code. Then press the Save button.

Have a good day!

Disclaimer: This blog post contains one possible custom workaround solution for users with similar use cases. We cannot guarantee that the custom code solution described in this post will work in every scenario or with every Sisense software version. As such, we strongly advise users to test solutions in their environment before deploying them to ensure that the solutions proffered function as desired. To avoid doubt, the content of this blog post is provided to you “as-is” and without warranty of any kind, express, implied, or otherwise, including any warranty of security and or fitness for a particular purpose. The workaround solution described in this post incorporates custom coding outside the Sisense product development environment and is, therefore, not covered by Sisense warranty and support services.

Rate this article:
Version history
Last update:
‎10-10-2024 09:06 AM
Updated by:
Contributors