Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
TKendrick20
Partner - Specialist
Partner - Specialist

Stacked Bar Chart Legend with Custom Colors

I have a stacked bar chart with custom colors. However, when I am using custom colors the option to also display a legend disappears. Is there any way to have a legend show up even though I am using custom colors?

Stacked Chart.PNG

Stacked Chart with Legend.PNG

13 Replies
ift_isabelle
Partner - Creator III
Partner - Creator III

I don't know a way to pull the colors from the Master dimension.

But what you can try is giving in the RGB code in the script.

Example

So in my app I have data from age by gender.

In the script i added:

Color:

Load * Inline [

Sex, Color

    Male, 'RGB(0,0,255)'

    Female, 'RGB(255,0,0)'

];

And in my background expression i used:

If(Wildmatch(Sex, '*ale'), Color, Lightgray())

that resulted in this:

Color_table.PNG

Is this what you are looking for?

linoyel
Specialist
Specialist

Yeah, that's exactly the strategy I've implemented in my app

I've used the Master dimension colors to use in bar charts, and RGBs in script for the same dimension that match Master dim colors - for background color expressions.

Thanks for all your help!

Sai_Mohan
Contributor III
Contributor III

Hi,

I have same problem of giving legends to stacked bar chart . Here i have used colour by expression so that legends are not visible.

Is there any extension for this to do?

Thanks,

sai

Yop1986
Contributor II
Contributor II

Hi, the only way i found to do this, was creating a meassure in master items and assigning the color to this.