Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Changing graph bar color depending on a formula

Dear all,

I need to change the color of the bars within a graph chart depending on the result of a IF formula like this:

If(Date_libere.PRIMA_DATA_LIB-Today()-Tipo_Raggrup.TMP_GG<0,1,If(Date_libere.PRIMA_DATA_LIB-Today()-Tipo_Raggrup.TMP_GG=0,2,3))

In short words I need that bars become Green, Yellow and Red simulating the functioning of a Led traffic light (see picture).

If the date is on delay respect to Tipo_Raggrup.TMP_GG reference I need to show it on red . In a specific range yellow , otherwise green.

Thanks Giovanni

error loading image



2 Replies
Not applicable
Author

Go to chart properties -> expressions tab.

In the treeview list to the left, expand the expression you want to modify. You will see the Background Color attribute expression. Click on it and add your color expression in there. In your case it would look something like:

If(Date_libere.PRIMA_DATA_LIB-Today()-Tipo_Raggrup.TMP_GG<0,Red(),If(Date_libere.PRIMA_DATA_LIB-Today()-Tipo_Raggrup.TMP_GG=0,Green(),Yellow()))

Not that you may also use an the RGB function (instead of Green() and Red() etc) to define a color with better precision. For example, red will be RGB(255,0,0) and dark gray is RGB(50,50,50).

Good luck.

Not applicable
Author

Thanks Kin,

Works Fine.

Now I have a sorting problem on showing data but I have no sort field to manage.

Have a look on attached Jpg.

Thanks again

Giovanni