Qlik Community

Qlik Sense App Development

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

Announcements
Qlik® Product Spotlight: Discover what’s possible. Get more from our products.
See for yourself. Register today.
Not applicable

want to add expresion for my color.

I want to add custom in my Color lable in my qlik sense extension.(I want to sue "by expresion"). Can someone help me

Tags (1)
1 Solution

Accepted Solutions

Re: want to add expresion for my color.

I have downloaded it, had a look and it seems that you need to create a second expression and in that do your colour expression:

With some test data I used this expression :

    if ([Obesity %] > 20 , red() , yellow() )

And it coloured the bubbles as per the expression.

You will need an expression as per your data model and needs.

It does allude to this in the description on both Branch and GitHub.  Albeit a bit obliquely.

Measure 2 (optional): This measure allows you to define a custom color based on the dimension and measure data. For example, you could create a measure that colors the bubbles red when they pass a certain threshold, but blue otherwise.

This is the bit in gridchart.js starting line 123 that adds the circles and the last line pasted below controls the colour should you wish to customise it.

// Add the circles

var circles = svg.selectAll(".circles")

   .data(data)

   .enter()

   .append("circle")

   .attr("class","circles")

   .attr("cx",function(d) {return x(d.Dim1) + x.rangeBand()/2;})

   .attr("cy",function(d) {return y(d.Dim2) + y.rangeBand()/2;})

   .attr("r",function(d) {return r(d.Value)})

   .attr("fill",function(d) {return d.InputColor == "N/A" ? user_prop.value : ARGBtoRGBA(d.InputColor);});

10 Replies
Not applicable

Re: want to add expresion for my color.

Hi Juthika.

You can use the functions rgb() or argb(), they will both return colors and you can use any color picker to find the values you like.

Not applicable

Re: want to add expresion for my color.

Hi Juthika,

I didn't got what exactly you want to say.

But I have done a demo with using color 'by Expression'.

Expression I have used is mentioned below,

if(count2>'0' and count2<5,rgb(100,200,150),if(count2>='6' and count2<9,rgb(150,50,70),rgb(10,20,50)))

kindly check.

Not applicable

Re: want to add expresion for my color.

I am using a extesion chart called "grid Chart". I dont see this "Custom " in color. How can I add that in my java script from back end.

Re: want to add expresion for my color.

Is this the extension on Qlik Branch you are using GitHub - skokenes/Qlik_Sense_Extension-GridChart: A grid chart for Qlik Sense ?

Not applicable

Re: want to add expresion for my color.

Yes, this is the one I am using.

Re: want to add expresion for my color.

I have downloaded it, had a look and it seems that you need to create a second expression and in that do your colour expression:

With some test data I used this expression :

    if ([Obesity %] > 20 , red() , yellow() )

And it coloured the bubbles as per the expression.

You will need an expression as per your data model and needs.

It does allude to this in the description on both Branch and GitHub.  Albeit a bit obliquely.

Measure 2 (optional): This measure allows you to define a custom color based on the dimension and measure data. For example, you could create a measure that colors the bubbles red when they pass a certain threshold, but blue otherwise.

This is the bit in gridchart.js starting line 123 that adds the circles and the last line pasted below controls the colour should you wish to customise it.

// Add the circles

var circles = svg.selectAll(".circles")

   .data(data)

   .enter()

   .append("circle")

   .attr("class","circles")

   .attr("cx",function(d) {return x(d.Dim1) + x.rangeBand()/2;})

   .attr("cy",function(d) {return y(d.Dim2) + y.rangeBand()/2;})

   .attr("r",function(d) {return r(d.Value)})

   .attr("fill",function(d) {return d.InputColor == "N/A" ? user_prop.value : ARGBtoRGBA(d.InputColor);});

Not applicable

Re: want to add expresion for my color.

For me all the time I am getting yellow colored boubble when used the expression. What is this "Obesity". Then how can I color the bubble as  yellow when it is 1 other wise blue

Not applicable

Re: want to add expresion for my color.

I  used  the level of the measure for color expression, and it worked. Thank you so much for your help.

Re: want to add expresion for my color.

Glad you are ok now.

[Obesity %] was a field from my test data model.