Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
musketeers
Creator
Creator

consistent bar chart color

Hi, I have a bar chart in dashboard. I need to display sum of sales for region wise and sales prediction.

Now sales prediction has three values:

1. Win

2. Risk

3. Other

The sum of sales should not affect when sales prediction is selected and sales_Person is selected.

So I am using :

sum({<Sales_Prediction=,sales_Person=>} sales)

My first dimension is Region and second in Sales_Prediction. I am using stacked bar chart.

Now I need to color the bar chart as if sales prediction is WIN then Color_1, if RISK then Color_2 and if Other then Color_3.

I am using background color in expression to provide color in bar chart as per sales prediction.

My problem is:

When I am selecting the sales person for whom sales prediction is OTHER, the data in bar chart is not changing (Whis is right), but the color of the bar chart is changing to OTHER sales prediction color.

Is there any way to make the color of the bar chart constant.

I am not supposed to use Alternate state.

Thanks for your help

1 Solution

Accepted Solutions
sergio0592
Specialist III
Specialist III

I have mistaken, you must past in the background color expression of your expression.

I have fixed your issue with using  Only({<Sales_person=>} Color_pred) in the background color expression.

See the attached qvw file.

Regards

View solution in original post

7 Replies
sergio0592
Specialist III
Specialist III

Hi,

Should work with table color in your load statement.


Create a table color with the RGB value for each value of Sales_Prediction

COLOR_PRED:
LOAD *
,
rgb(R,G,B) as Color
INLINE [
Sales_Prediction,R,G,B
Win,0,234,0
Risk,2,223,130
Other,205,255,155
]
;

Put Color in the background color expression of your second dimension  Sales_Prediction.

sunny_talwar

What is the background expression that you are using?

musketeers
Creator
Creator
Author

Hi Jean,

Thanks for your reply.

So the field Sales_Prediction in inline table will linked to my table.

In this case color will change when I will select sales person who has sales prediction as OTHER.

I do not want bar color to change when I select sales person from list.

Please correct me if I am wrong.

musketeers
Creator
Creator
Author

Hi Sunny,

I am using IF else condition for Bar color.

sergio0592
Specialist III
Specialist III

I have mistaken, you must past in the background color expression of your expression.

I have fixed your issue with using  Only({<Sales_person=>} Color_pred) in the background color expression.

See the attached qvw file.

Regards

sunny_talwar

What does that if then else statement look like

musketeers
Creator
Creator
Author

Hi Jean,

Thanks for your help. I am able to achieve this.