Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us in Toronto Sept 9th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
anuradhaa
Partner - Creator II
Partner - Creator II

Colors in multiple pie chart

Hi,

I want to have two pie charts (inner and outter). i have done it by adding two dimension.

But when i do so the colurs are same.

inner chart it has RED and BLUE and outtter chart also same.

Is there any way to change the color of either inner or outter chart.

see attached

9 Replies
sibideepak
Creator II
Creator II

Hi Anuradha ,

As far as I know there is no direct solution for this in qlikview,

You can do it with IF Statement in Background Color for expression.

Else another best solution, if your data set is small you could set RGB value for your DImension,

And use it as your background color .

anuradhaa
Partner - Creator II
Partner - Creator II
Author

Can you please send me a sample with if statement

Thanks

stevedark
Partner Ambassador/MVP
Partner Ambassador/MVP

To use an IF statement you need to manually specify a colour, using RGB, for every possible dimension value.  If that works for you then great.

=if(Only(DimensionName) = 'Value1', rgb(255,100,100),

  if(Only(DimensionName) = 'Value2', rgb(100,255,100),

  null()))

Where DimensionName is the dimension for the ring of your pie chart and Value1 is the value you want to set the colour for.  If no match is found then it will default to the colours on the Color tab of the properties.

This code is inserted by clicking on the Plus symbol next to the Expression and selecting Background Colour.

Hope that helps,

Steve

anuradhaa
Partner - Creator II
Partner - Creator II
Author

can you share a sample.

stevedark
Partner Ambassador/MVP
Partner Ambassador/MVP

Hi,

Please see the colour expression behind the Expression Background Colour in this example.

For a two dimensional chart you need a more complex IF statement, for the inner and outer wedges.

Something like:

=if(Only(Dimension) = 'Value1',

          if(Only(Dimension2) = 'OuterValue1', rgb(255, 120, 120),

          if(Only(Dimension2) = 'OuterValue2', rgb(255, 140, 140),

          if(Only(Dimension2) = 'OuterValue3', rgb(255, 160, 160),

          rgb(255,100,100))))

     ,

  if(Only(Dimension) = 'Value2',

          if(Only(Dimension2) = 'OuterValue1', rgb(120, 255, 120),

          if(Only(Dimension2) = 'OuterValue2', rgb(140, 255, 140),

          if(Only(Dimension2) = 'OuterValue3', rgb(160, 255, 160),

          rgb(100,255,100))))

   ,

  if(Only(Dimension) = 'Value3',

          if(Only(Dimension2) = 'OuterValue1', rgb(120, 120, 255),

          if(Only(Dimension2) = 'OuterValue2', rgb(140, 140, 255),

          if(Only(Dimension2) = 'OuterValue3', rgb(160, 160, 255),

          rgb(100,100, 255))))

, null())))


This would give darker wedges for the inner wedges and then gradients of that colour for the outer ones.


In general I would steer clear of two dimensional pie charts...



Steve

anuradhaa
Partner - Creator II
Partner - Creator II
Author

Hi, this is only one demencial pie. in my case i have two demenssions

stevedark
Partner Ambassador/MVP
Partner Ambassador/MVP

Here it is with two dimensions.  The second dimensions legend is not coloured correctly, but then as you have the same secondary dimension in each of the first dimensions it is perhaps not surprising.

Hopefully you can work something from here to solve your issue.

anuradhaa
Partner - Creator II
Partner - Creator II
Author

Thank For your reply , but legend colors are important, otherwise user may get confused

stevedark
Partner Ambassador/MVP
Partner Ambassador/MVP

In the case of the example I uploaded QlikView would not be able to work out what colour to put on the second legend, as the same outer dimension value could have a different colour depending on what inner wedge it was attached to.  Your best bet, if you have fixed dimensions with fixed colours defined in script, is to build your legend in an image file and simply show that image in a text box.  To keep it looking consistent with other QlikView apps you could simply screen grab the legend with the wrong colours and then paint the correct colours in.  You can tell QlikView not to show a legend in the Properties of the pie chart.

I'm afraid you are going to have to do some work yourself here.

Steve