Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Nov. 20th, Qlik Insider - Lakehouses: Driving the Future of Data & AI - PICK A SESSION
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

How to increase the intensity of colour in SVG Reader for low values?

Hi,

I have created a US map, with few states in data. I want to show colour for these charts ranging from dark red (low population) to dark green(high population). I'm successful at getting dark green colour for high population but with low populations I only get faded red colour.

There exist one more issue too, that is I'm not able to set the state's name visible.

Can some one please give me a solution!

Im also attaching my data.

Note: I'm using trail version so I cant open your solution in  the form of ".qvw" file. Please explain your solution in text. Thanking you in advance.

Untitled2.pngUntitled1.png

1 Solution

Accepted Solutions
adamdavi3s
Master
Master

hahaha after all that all you actually needed to do was set your 'measure' to be 1!!!

Well that was a fun afternoon

Capture.PNG

View solution in original post

13 Replies
Anil_Babu_Samineni

Note: I'm using trail version so I cant open your solution in  the form of ".qvw" file. Please explain your solution in text. Thanking you in advance.

That is ok, Send qvw so that we may work for your file and then we will share if we got solution for Bright Red color to Thick red color.

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
adamdavi3s
Master
Master

I think you will find that the fill opacity is controlled in the javascript of the extension.

I've just done a quick test and the colour seems to render OK for me, you could simplify your if statement as well by having one rather than two

Capture.PNG

adamdavi3s
Master
Master

Ok yes the code seems to be applying  some sort of scaling to the colours as I get the same issue as you.

This is nice in some ways but not when you want to hard-code, unfortunately to change it would require a change to the extension itself. This might not be too tricky but I don't have the mental capacity today!

Capture.PNG

adamdavi3s
Master
Master

Yeah here is the code it is using:

fill: v,  "fill-opacity": d / i + (1 - d / i) * .2,

So basically take the colour then alter the opacity based on the measure.

If you simply leave it hard-coded as 1 you get what you want:

Capture.PNG

You can overwrite the script in the extension folder with the one I have attached if you want this effect.

Please remember to mark this as helpful or the correct answer if I have helped you or answered your question.

This will help users identify the answers should they come across this thread in the future.

.2,

adamdavi3s
Master
Master

Ok so I found my brainpower so I tweaked the extension for you so you can set a default.

There is a new setting "Fixed Opacity (0 is off)" if this is set to 0 then it scales.

Here are some example settings:

Capture.PNG

Capture2.PNG

Capture3.PNG

adamdavi3s
Master
Master

hahaha after all that all you actually needed to do was set your 'measure' to be 1!!!

Well that was a fun afternoon

Capture.PNG

Not applicable
Author

That was too easy, thank you so much for your help

adamdavi3s
Master
Master

haha it only took me 2hrs of code to get there 😄

Not applicable
Author

Do you know how to make the state names visible?

And now I have the original version. So, you can also reply with .qvw files