Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I have a Pie Chart with one Dimension (Department) and I want to set a specific color for each department. i.e Opex = brown, Z + R = blue, Part M = green ...
If the order changes (i.e. Z + R is 2nd or 3rd) then the department should still have the same color, Opex = red, Z + R = green, Part M = blue ...,
How can I define individual color for eych value of the dimension used in the Pie Chart, even if a value is numer 1 oder number 7?
Edit:
Here is another example. I have cities and the colors change when I select different times. But I need the same color for the same city, even when the city is first or last.
thank you
Open, Expression box and set the colors based on dimension values in the background color.
Enhancing this feature, you can have the colors RGB/brown,red,etc in data model and call them here.
say Dept,DeptColor; your expression would be =DeptColor
Kiran.
Just check the "persistent color" checbox on color properties. Colors will be stable, at least until next reload.
Open, Expression box and set the colors based on dimension values in the background color.
Enhancing this feature, you can have the colors RGB/brown,red,etc in data model and call them here.
say Dept,DeptColor; your expression would be =DeptColor
Kiran.
Thanks, thats the solution. The only thing now is, I have a if-statement with 7 stages
=if(city='Hamburg',rgb(10,110,100),if(city='Rostock',rgb(210,220,200),if(city='München',rgb(30,230,200),if(city='Berlin',rgb(40,40,100),if(city='Köln',rgb(50,50,500),if(city='Leipzig',rgb(60,60,100), if(city='New York',rgb(70,20,200))))))))
Is there a better way?
You could place this if statment in your script and then just place the field in the Backround expression box
In your script add a inline load of
city,CityColor
Hambur,rgb(10,110,100)
Rostock,rgb(210,220,200) etc...
In the formula have it as =CityColor
This should be lite on your expression and easily mainainable.
Kiran.
If all you need is a consistency of colors, my suggestion about the checkbox is more than enough.
Hardcoding colors in the script is relaible, but it makes sense only if you need more than simple consistency, e.g. the same colors for the same Cities all the time - but in this case you have to ensure that the list of cities is static, no new values. If the list of cities may change, there will be more complications that I consider unnecessary.
Thanks, thats what I need, the same color for the same city all the time, even if they change their order.
Hi Kiran,
when I add the color into the table then my Pie Chart is all black. Do you have a suggestion? I tried both, 1) adding the color into the inline table and 2) creating a new table with the color.
Hi
I think QV doesn't recognize a value = RGB( 10,100, 200). Why I don't know.
But if you create 3 fields corresponding of the 3 colors, it works with the formula RGB( R , V , B) in background color
color:
LOAD * INLINE [
R,V,B, city
10,110,100, Hamburg
210,220,200, Rostock
30,230,200, München
40,40,100, Berlin
50,50,200, Köln
60,60,100, Leipzig
100,100,200', New York
];
JJ