Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Use color by expression to match pie chart and bar graph colors?

Hello,

I want to color by expression in my bar chart so that the colors of the different Notification types match the colors in the pie chart.

I know I can use IF statements to color by expression in my gar graph (i.e. If([Notifictn type]='DR", green (), blue()), but how can I figure out what the exact colors are in the pie chart so that the colors will match?

1 Solution

Accepted Solutions
Gysbert_Wassenaar

The pie chart can also be configured to use an expression to assign colors to the segements. You can use an expression like =Color(FieldIndex('Notifictn type',[Notifictn type])) to always give each dimension value the same color. As long as you use the same expression in all the charts you'll get the same colors.


talk is cheap, supply exceeds demand

View solution in original post

6 Replies
Gysbert_Wassenaar

The pie chart can also be configured to use an expression to assign colors to the segements. You can use an expression like =Color(FieldIndex('Notifictn type',[Notifictn type])) to always give each dimension value the same color. As long as you use the same expression in all the charts you'll get the same colors.


talk is cheap, supply exceeds demand
Not applicable
Author

Thank you - do I use that expression in the appearance section where I would color by expression or in the data load editor?

Not applicable
Author

When I use that expression I get an error saying that the data set contains negative values

Gysbert_Wassenaar

Please post a small Qlik Sense document that demonstrates the problem.


talk is cheap, supply exceeds demand
vgadang1
Partner - Contributor III
Partner - Contributor III

Worked for me, super helpful!

Prem0212
Creator
Creator

In the apperance  section you would see the option of color by expression so that you can use the custom colors for both the charts.

or else you can use the custom theme.