How to apply color to 'Break by' legends based on another column.
Currently I have around 40 items in 'Break By' legend. I want to apply color based on their category (4 category - 4 color)
merinsverghese
Posted 2 years ago·Last reply 2 years ago
4 comments
RAPID BI Support
·2 years agoHey merinsverghese ,
There are a few ways to do this (like sending additional jaql queries in the widget script, but I think the more simple and efficient way is below (despite feeling a bit more hacky):
In the datamodel, you'll need to create a new column indicating the grouping "<group>_<item>" to use as the break_by:
Then we can create 'colorConfiguration' based on the text for each value before the '_'. We'll assign each unique category a color based on the dashboard pallette (colors) and then use similar logic to run through the categories.
Updated widget script:
Which results in:
A few things:
If you need any additional customization - feel free to take us up on our free 30-minute consult: https://www.rapidbi.com.au/sisense-add-ons/Services/Free-30-Minute-Sisense-Consultation/
Let me know how you go?
Thanks,
Daniel
RAPID BI
daniel.ranisavljevic@rapidbi.com.au
RAPID BI - Sisense Professional Services | Implementations | Custom Add-ons
merinsverghese
OP2 years agoThis solution worked for me. Thankyou Daniel.
Regards,
Merin
RAPID BI Support
·2 years ago · EditedHi merinsverghese ,
You could do something like this on a widget script:
You can add to the colorConfiguration in the script to add different groups of breakby categories to color by.
Additionally, youi can set different colors for the column bar borders by adjusting borderColor lower in the script.
This results in:
Let me know how you go?
Thanks,
Daniel
RAPID BI
daniel.ranisavljevic@rapidbi.com.au
RAPID BI - Sisense Professional Services | Implementations | Custom Add-ons
merinsverghese
OP2 years agoHi Daniel,
Thank you for the solution, I tried out the same. In my case the items in the break by (field - 'Item') will increase day by day. So I need a dynamic solution, that will pick the corresponding category from the available field('category') in the data model.
Regards,
Merin