6 Replies Latest reply on Nov 28, 2016 9:25 AM by Michael Kurbel

# Gradual Color Change On Same Bar Of Bar Graph

Hello!

I am wanting to have each bar of my bar graph change color depending on where it's at compared to the threshold. For example, Cybersecurity Threat Management would start green and then change to yellow once it got half way to the threshold and then red once it hits/passes threshold. The only thing that I can come up with at the moment is having the whole bar yellow if it's final value is equal or greater than half of the threshold, the whole bar red if it's greater than the threshold and the whole bar green if it's final value is less than half of the threshold.

• ###### 1. Re: Gradual Color Change On Same Bar Of Bar Graph

It's difficult to change the color gradually, but a couple of step changes are available

[Bottom]

min(sum([Threshold in percentage])*.8,sum([Value in percentage]) )

[Middle]

sum([Value in percentage])-[Top]-[Bottom]

[Top]

max(0,sum([Value in percentage])-sum([Threshold in percentage]))

Thanks,

Shin

1 of 1 people found this helpful
• ###### 2. Re: Gradual Color Change On Same Bar Of Bar Graph

Hi Michael;

I think generally, less is more, and a single color (or in the case wonderfully outlined above, three colors) can

• improve visual processing speed of your users and
• reduce misunderstandings.

If you're stuck on color gradations, though, it can be done (just ask yourself first: "should it be done? Am I telling the user the story I need to tell?" )

I was able to do it by linking every element to a table of 21 elements (the values 0% through 100% in 5% increments).

I multiplied the maximum value of each "threat" by the 21 reciprocals in the table and mapped it as Gantt view:

As Shinichiro Murakami outlined above, this is not a simple process, and as you can see above it's not very smooth.

If you still want to go this route, let me know and I'll outline my steps.

• ###### 3. Re: Gradual Color Change On Same Bar Of Bar Graph

Shinichiro Murakami: This was an awesome explanation!

• ###### 4. Re: Gradual Color Change On Same Bar Of Bar Graph

Hi Michael,

I agree less is more but unfortunately, the bosses disagree with me. I would love if you outlined your steps. Thank you and Shinichiro for the replies!

• ###### 5. Re: Gradual Color Change On Same Bar Of Bar Graph

Hello Michael,

Here's how I did it. For all of those other Tableau artists & programmers that see this and groan and tell you it's sloppy work: Believe them!

.

It's not pretty. It's impractical. And it sets poor precedence for visualizations (basically throwing open the French doors and tossing all the K.I.S.S. lessons out, along with the bath water and the baby!)

Nevertheless, in the plight of "pleasing the powers that be," here's a go:

I was uncertain what your data looked like, so I built some myself. These are potential threats to Batman, being the Joker, the Riddler, and Kittens.

Each threat has a threat level associated with it (a threshold). This is when Commissioner Gordon would send up the Batsignal to summon the Caped Crusader.

But enough comics...

On my primary data sheet I created a LINKER dimension. This is just a field called LINKER with a value "Link."

Next I created a linking sheet with 20 Nodes with values 5%-100%

I linked these together and created a color formula:

Color

[Sightings]/[Threshold]*-[Percent]

If we break this down:

• INCREASING [Sightings] takes you further from 0
• DECREASING [Sightings] leads you closer to 0
• The HIGHER the [Threshold], the closer to 0 you will be
• The SMALLER the [Threshold], the further from 0 you will be

Note there's a little bug here: color values range from -100 to 0; I think this is could be solved by reversing the order of the nodes.Like I said: messy.

I also added a few additional conditional calculations for displaying the Batsignal, etc.

Take a look at it and see what you think. My suggestion: I think most people process SIZE before COLOR. They are visually drawn to the tall bars first, not realizing that the Joker could be creeping up the back way. And Kittens (which are really no threat at all) look *about* as imposing as the Riddler. That said: consider if you can represent this data not by color, but as nearing to threshold. Your problem areas may jump out at you that way, and color (or a tool tip) can be used to drill down.

I know from experience that it can be a tough sell when taking to the big wigs. But perhaps you can make a couple of views and show them in quick succession?. Good luck!

1 of 1 people found this helpful
• ###### 6. Re: Gradual Color Change On Same Bar Of Bar Graph

Thank you to both. I believe this has answered my question!