Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
punitpopli
Specialist
Specialist

Dynamically change colour of Products in a chart

Hi All,

I am having a requirement as :

To display products in a stack chart based on parent selection and every product should show specific colour provided by user

For eg: If I select a Region Asia then its countries should be displayed in a stack with India in Blue , China in Red, Srilanka in Yellow and so on.

If I select region as Europe then its countries should be displayed in a stack with France in Navy blue, Germany in Green,Finland in Grey and so on

I have tried implementing the changes as per the blog on community Create Colour Variables from an Excel Workbook 

But, in my case there are nearly 72 products and based on its parent selection the products are displayed in a stack chart, and we need to show the specific colour  i.e. RGB() colour given by client.

Does anyone have face similar kind of issue?

Thanks in advance

Punit.

1 Solution

Accepted Solutions
jpenuliar
Partner - Specialist III
Partner - Specialist III

HI,

Have a look at example:

View solution in original post

8 Replies
Anonymous
Not applicable

Hi,

Create a table with Country and ColorCountry fields and load it in script. Then in expression color type:

=only(ColorCountry)

Hope it helps.

Marc.

Anonymous
Not applicable

Punit,

I also atached a sample colors file.

Marc.

punitpopli
Specialist
Specialist
Author

Hi marc carreras :

In the expression colour type did you mean the background colour in expression as "Only(ColourCountry)"?

As I am trying the same way but no luck, attached is the QVW.

Could you please take a look?

Thanks

Punit

Anonymous
Not applicable

Punit,

ok, then I guess best solution is to set a variable with the color calculation and then use it in the expression. Find attached and check variable to extend it to all the countries (hard work but only once). Then check background color expression in chart expression.

Marc.

jpenuliar
Partner - Specialist III
Partner - Specialist III

HI,

Have a look at example:

Anonymous
Not applicable

Sorry, the variable vColor defining correct colors:

if(only(Country)='China', RGB(100,0,50),

if(only(Country)='Germany', RGB(0,0,150),

...

))

and try this in the background color expression:

=$(vColor)

Marc.

jduenyas
Specialist
Specialist

The approach is nice but good for only limited number of customers, products etc.

punitpopli
Specialist
Specialist
Author

Thank you Jonathan Penuliar , It work for me..