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

This article will show you how to quickly color a pivot table into two sections: by Row and by Value

1. Build your pivot table.

2. In the widget editor, add the widget script below. Information on how to add a widget script here: https://sisense.dev/guides/js/extensions.html

 

 

widget.transformPivot(
    {
        type: ['value','member']
    },
	
    function setCellBackground(metadata, cell) {
		
	
		if(metadata.type == 'value'){
        cell.style = cell.style || {};
        cell.style.backgroundColor = '#9A94BC';
		} else {
		cell.style = cell.style || {};
        cell.style.backgroundColor = '#ffe6e6';
		}
		
    }
);

 

 

3. Change the colors by changing the color codes above and you're all set!

Screen Shot 2022-03-31 at 14.57.40.png


Note: If you'd like to target different parts of the pivot table, refer to our Pivot 2 API documentation.

Comments
harish
8 - Cloud Apps
8 - Cloud Apps

Hii, I have pivot table merchant names and sales , now i want to color the  top 3 and bottom 3 of sales column , top 3 should be green and bottom 3 should be red . How can i achieve that

 

Version history
Last update:
‎02-05-2024 12:50 PM
Updated by:
Community Toolbox

Recommended quick links to assist you in optimizing your community experience:

Developers Group:

Product Feedback Forum:

Need additional support?:

Submit a Support Request

The Legal Stuff

Have a question about the Sisense Community?

Email [email protected]

Share this page: