Qlik Community

Ask a Question

App Development

Discussion board where members can learn more about Qlik Sense App Development and Usage.

Announcements
Support Cases coming to Qlik Community Oct. 4! Start chats, open cases, explore resources: READ DETAILS
cancel
Showing results for 
Search instead for 
Did you mean: 
gdipasquale1
Contributor
Contributor

Vizlib pie chart - custom colors

Hi, I'm actually using the Vizlib library, and specially the Pie chart component.

The pie chart provides an option for custom colors.

The official website says :

  • Use Custom Colors
    You have got the freedom to choose your own collection of colors. This is particularly useful when you wish to be consistent with your corporate colors e.g.. Just specify a commma separated list of hex-colors (#4477aa,#7db8da,#b6d7ea,...) and Vizlib Pie Chart will loop through it and dynamically assign the colors to the lines.

So ok, I'm using a list of value like : '#ffce44,#f07f3c,#ea5153,#0085b9,#3f5782,#814a84,#dddf4b,#297e4c', for my colors. Each value represents a category.

For example I want to display a list of assets, categorized by asset_type. And I want that a specified asset_type got a specified color.

Everything runs well, when I have at least one asset of each asset_type, but when an asset_type is empty, the pie chart will display the wrong colors.

I've tried to use a a variable which contains my list of colors (vColors) and then with some if and the PurgeChar function, I'm able to remove the specified color from the list.

For example, I can do something like this :

=if(Sum({$<[asset_type] = {'1'},[asset_group]>}[asset_value])=0,PurgeChar(vColors,'#ffce44, ',vColors)

But I can have a lot of possible combinations, so I'm' looking for a smart way to do that, for example modifying my variable.

Something like :

=if(Sum({$<[asset_type] = {'1'},[asset_group]>}[asset_value])=0,vColors = PurgeChar(vColors,'#ffce44, ',vColors)


Modifying my variable and at the end 'returning' this variable but I don't know how to do that with Qlik.


Any idea ?


Thanks for your help.

1 Reply
Giuseppe_VizLib
Partner
Partner

Hello!  🙂

You may reach us at support@vizlib.com 

or you can open a ticket after you login to our User Portal.

You can also evaluate as a free trial, by downloading and installing our Vizlib June 2019 Release.

regards

Giuseppe

Vizlib Customer Success Manager