A nice value-add to Pivot Charts is to colour certain rows or columns based on certain rules/measures.
if (e.area == 'data' && e.rowIndex == 1)
{if (e.cell.value < 0.075) {e.cellElement.css('background-color', 'rgba(193,39,45,0.4)');}
else if (e.cell.value >= 0.075 && e.cell.value <= 0.085) {e.cellElement.css('background-color', 'rgba(248, 219, 119, 1.0)');} else if (e.cell.value > 0.085) {e.cellElement.css('background-color', 'rgba(198, 239, 206, 1.0)');}}
What
needs to change is the:
1. “e.rowIndex == [rownumber]”
2. “e.cell.value more or less than”
3. ‘rgba(colour)’ – you can ask ChatGPT for the rgba colour you are looking for – for example green/red/blue/etc.
The result of the above Cell
Customization:
If the value is less than 7.5% (0.075), the colour is red;