How to show 2 colors for 1 legend item?
I am building a bar chart show actual vs target number. And in my actual number, I am using a conditional color if it is over the target then show yellow if not show blue here.
After I added the conditional color on the "Actual sale" value, the legend item colors are all in grey. Is there a way to show this icon color as how it is on the values on left panel (blue + yellow color)?
color wanted:
DXC
Posted 1 year ago · Edited 1 year ago·Last reply 1 year ago
6 comments
Tri Anthony
·1 year agoHi DXC,
Below is a script you can use to replace the grey box for the measure with conditional formatting with a two-tone box, one for each of the selected colors. If you need to reuse the script for another widget, make sure to update the line below with the correct measure name.
const measureName = "Actual Sale"
Example:
Script:
DXC
OP1 year agoHi TriAnthony this works PERFECT!! Appreciate your help!!
DXC
OP1 year agoHi @TriAnthony thank you again on sharing this script! On my dashboard, there are a few more different widgets but with the same Target Sales and Actual Sales measure names. After I apply this script in all widgets, only one widget has the updated 2 tone color, the rest are still in grey. Is there a way to make them all work?
Tri Anthony
·1 year ago · EditedHi DXC,
Thank you for pointing that out! I have updated the script in my original comment. It now works for all widgets the script is applied to, and the legend colors are consistent with the colors selected at the widget configuration.
See an example below.
DXC
OP1 year agoThis script works great! Thank you TriAnthony !
Tri Anthony
·1 year agoHi DXC,
Just wanted to quickly follow up on this. My team and I wrote a community plugin for this requirement, so individual widget scripts can be avoided, if preferred. You can find the plugin here: Plugin - Enable Multicolor Legend Items for Conditional and Range.
I hope this is helpful.
-Tri