Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Different transparancy / color in an image based on frequencies

Hello everyone,

maybe you know images like those:

http://www.nature.com/ncomms/journal/v1/n8/images/ncomms1104-f2.jpg

So basically within this image we have different "areas" and every area is colored according to a specific frequency of an occurence.

So no my case is a bit different. I want to create the silouette of a body.

Then i want to add "organs". According to the events within an organ ("e.g. injury) i want to grade its color in respect to all other organs.

So lets say we have 100 injuries. 5 occure within the brain, 95 within the lung then the lung should be much darker.

My idea would be the following:

1. I draw the silouette of a body.

2. For every organ i create a button with a bright red color.

3. I have a table which tells me e.g. brain = 5, lung = 95 etc.

4. Now according to this table, the transparancy of the button changes. E.g. brain transparency = 95%, lung = 5%.

So i guess there is a way to specify the transparency of a button according to a table. I have no clue how to do this yet, but does anyone have any idea how to start this? I am not shy of work - so i am open for any idea - even if it means tons of work!

1 Solution

Accepted Solutions
rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

If you want to draw very specific regions of color on the body, you'll need to use an SVG Map extension. You can find one here:

SVG Map Extension

Then you just need to find an SVG file of the human body, Google for it, you'll find one

-Rob

View solution in original post

7 Replies
rubenmarin

Hi Daniel, there is an ARGB() function wich have 4 parameters whose values goes from 0 to 255:

1st: transparency, lower value means more transparent

2nd: red code

3rd: green code

4th: blue code

So Argb(128,255,0,0) gives a semi-transpared red, you can work the formula that returns the results you're expecting, ie:

=Argb(Fabs(100-TransparencyField)*2.5,255,0,0)

Not applicable
Author

Hello Ruben,

thanks a lot for your reply.

Now at the moment i am not sure where to "put" the code you just wrote and what action i need to define to call it.

So i created a textbox with a background and tried to put it under

Action => Dynamic Update => =Argb(128,255,0,0)

Does not rly work yet.

What i figured out what alrdy worked for me was writing (or rather copiing) a VBSkript Macro and calling it when the document opens or changes:

sub SetTransparentImage

  set image = ActiveDocument.GetSheetObject("TX11")

  set imageProps = image.GetProperties

  imageProps.Layout.BkgAlpha = 50

  image.setProperties imageProps

end sub

So this changes the transparency of the image TX11 to 50%. My problem here would be, that i do not know how to change the Alpha to the values according to my table.

Anyways - i would rather prefer the solution you suggested with the different color channels, but like i said i do not know yet where to put the given code so that the images dynamically update when a change in the table occures.

rubenmarin

Hello Daniel,

You can set a calculated color as color property:

Background in text boxes and buttons aren't related to any data, so you'll need to use some set analisys, ie:

=Argb(Fabs(100-Only({<Organ={'Brain'}>} TransparencyField))*2.5,255,0,0)

And Other parameter can also be dynamic:

=Argb(Fabs(100-Only({<Organ={'Brain'}>} TransparencyField))*2.5,Only({<Organ={'Brain'}>} RedCodeField), Only({<Organ={'Brain'}>} GreenCodeField), Only({<Organ={'Brain'}>} BlueCodeField))

Not applicable
Author

Hello Ruben,

thank you for this reply. It is already very helpful.

Now my only problem with your solution is, that when i color a textbox or button it has its "standard" rectangular shape since i have to decide for either color or image.(or can i use both)

So with this i can not rly fill individual parts of a body with color if you know what i mean.

For instance with this way i think it would be very hard to draw a colored world map.

Maybe it could work to define the textboses as background color and draw the silouettes over it.

What are your thoughts about it.

rubenmarin

Hi Daniel, I'm not sure of what you're trying, the first time I read thought in a background image of a body and bright red buttons located in an upper layer over different organs of the main image, those red buttons can be more o less transparent dinamically based on the values readed from a table, isn't this what you're trying?

I wouldn't try to draw a map or a body using text boxes, only one big text box with the image.

rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

If you want to draw very specific regions of color on the body, you'll need to use an SVG Map extension. You can find one here:

SVG Map Extension

Then you just need to find an SVG file of the human body, Google for it, you'll find one

-Rob

Not applicable
Author

Thanks Rob und Ruben,

i think i will try out the SVG Map Extension. It is basically exactly what i was looking for!

Thanks,

Daniel!