Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
Inna_Shnaiderman
Contributor III
Contributor III

Slider for Metro Map which enables to configure the colors range

Hi,

I have a Metro Map with data  on stations. The circles should get colors - green, yellow, red accordingly to some range on data they have.

So, I need to create a slider which will show three scales - for the green\yellow\red color.

Can you please advise me how to do that?

I tried to look in the following link, bit it is not working there:

https://community.qlik.com/t5/New-to-Qlik-Sense/How-to-use-Range-slider-in-qlik-sense/td-p/992934

https://community.qlik.com/t5/Documents/Qlik-Sense-Introduction-to-Extensions-video/ta-p/1480079

 

 

Labels (2)
1 Solution

Accepted Solutions
mato32188
Specialist
Specialist

Hi @Inna_Shnaiderman,

ok, now I've got your point.

In script just add two new rows (variables) of code, i.e.:

SET vLowerBorder = 0.01; //default value to be 0.01
SET vUpperBorder = 0.08; //default value to be 0.08

In color expression use $(vLowerBorder) and $(vUpperBorder) instead of values you currently use.

=if(
count({<is_active = {'1'},is_exception = {'1'}>}distinct order_unit_id)/count(distinct order_unit_id)>=0 and count({<is_active = {'1'},is_exception = {'1'}>}distinct order_unit_id)/count(distinct order_unit_id)<$(vLowerBorder),
green(),

if(

count({<is_active = {'1'},is_exception = {'1'}>}distinct order_unit_id)/count(distinct order_unit_id)>=0.01 and count({<is_active = {'1'},is_exception = {'1'}>}distinct order_unit_id)/count(distinct order_unit_id)<$(vUpperBorder),
yellow(),red())).

By the way, you can adjust a bit your color expression to make it easier and faster calculated. I do not expect to have negative values as a result of calculation, so it could possibly look like:

if(count({<is_active = {'1'},is_exception = {'1'}>}distinct order_unit_id)/count(distinct order_unit_id)<$(vLowerBorder), Green(),

if(count({<is_active = {'1'},is_exception = {'1'}>}distinct order_unit_id)/count(distinct order_unit_id)<$(vUpperBorder), Yellow(),Red()))

Then in the front-end (GUI) use following object and variables you have created.

mato32188_0-1620627088586.png

BR

m

 

ECG line chart is the most important visualization in your life.

View solution in original post

4 Replies
mato32188
Specialist
Specialist

HI @Inna_Shnaiderman ,

I am not sure whether I catch your point. I would propose kind of possible solutions for you:

If it is not suitable for your case, could you please provide sample of data and any visualization you want to achieve?

Thanks.

m

ECG line chart is the most important visualization in your life.
Inna_Shnaiderman
Contributor III
Contributor III
Author

Hi.

I went over the link and it is not exactly what I need.

I wrote formula (working), which for every percentage gives its color:

=if(
count({<is_active = {'1'},is_exception = {'1'}>}distinct order_unit_id)/count(distinct order_unit_id)>=0 and count({<is_active = {'1'},is_exception = {'1'}>}distinct order_unit_id)/count(distinct order_unit_id)<0.01,
green(),

if(

count({<is_active = {'1'},is_exception = {'1'}>}distinct order_unit_id)/count(distinct order_unit_id)>=0.01 and count({<is_active = {'1'},is_exception = {'1'}>}distinct order_unit_id)/count(distinct order_unit_id)<0.08,
yellow(),red()))

 

I need instead of fixed percentage (0.01,0.08 and more) to make it configurable. Means the percents for colors should be changeable variables. The variables should be changed by users.

Questions:

1. How to create in Qlik Sense Variables?

2.How these variables can be changed by users in UI?

mato32188
Specialist
Specialist

Hi @Inna_Shnaiderman,

ok, now I've got your point.

In script just add two new rows (variables) of code, i.e.:

SET vLowerBorder = 0.01; //default value to be 0.01
SET vUpperBorder = 0.08; //default value to be 0.08

In color expression use $(vLowerBorder) and $(vUpperBorder) instead of values you currently use.

=if(
count({<is_active = {'1'},is_exception = {'1'}>}distinct order_unit_id)/count(distinct order_unit_id)>=0 and count({<is_active = {'1'},is_exception = {'1'}>}distinct order_unit_id)/count(distinct order_unit_id)<$(vLowerBorder),
green(),

if(

count({<is_active = {'1'},is_exception = {'1'}>}distinct order_unit_id)/count(distinct order_unit_id)>=0.01 and count({<is_active = {'1'},is_exception = {'1'}>}distinct order_unit_id)/count(distinct order_unit_id)<$(vUpperBorder),
yellow(),red())).

By the way, you can adjust a bit your color expression to make it easier and faster calculated. I do not expect to have negative values as a result of calculation, so it could possibly look like:

if(count({<is_active = {'1'},is_exception = {'1'}>}distinct order_unit_id)/count(distinct order_unit_id)<$(vLowerBorder), Green(),

if(count({<is_active = {'1'},is_exception = {'1'}>}distinct order_unit_id)/count(distinct order_unit_id)<$(vUpperBorder), Yellow(),Red()))

Then in the front-end (GUI) use following object and variables you have created.

mato32188_0-1620627088586.png

BR

m

 

ECG line chart is the most important visualization in your life.
Inna_Shnaiderman
Contributor III
Contributor III
Author

Great!Working!