Gradient Gradient Area Chart Challenge




Gradient Area Chart Challenge

Earlier this week, my twin brother, Ken Flerlage posted a blog post about utilizing gradient color in a bar chart and area chart.  Ken describes how he used data densification to create hundreds of artificial segments within the chart then colored them accordingly.  When he tweeted it, he issued a challenge to me:


Well, I have just one response to that tweet:


Perhaps because I’ve only been using Tableau for about a year, I always tend to look for an easier way.  You may have read about my no polygon technique and the way I utilize dashboard buttons, both of which are techniques used to simplify the process.  Ken and I have also had many conversations about this in other aspects of Tableau.  Take his blog post about color-theming.  If you read through that blog post, you’ll get to a section labeled “Another Approach” where Ken says:
         
After finishing this blog, I sent it to my brother, Kevin Flerlage, and asked him to review it to make sure it all made sense. He gave me the thumbs up, but then suggested another possible solution—why not create separate versions of the dashboard, each with its own color theme, then use dashboard buttons (also a new feature in 2018.3) to jump from one dashboard to the other. What a great idea! Thanks Kev!!
Generally, I always try to find the easiest approach.  So, let’s give it a go on this one.  

Before I do so, I want to give credit where credit is due.  Long before I wrote this (when I had only been using Tableau for a couple months), Adam McCann had written about a similar technique and did it in a much better way that me :)  Check it out in his Pattern Fill Bar Chart in Tableau blog post.  I also learned that Alexander Varlamov did something similar as well.  Please see his Making Transparent Bar Charts in Tableau blog post.  


Okay, go to Ken’s gradient color blog post and find the section labeled “Area Chart Method 2”.  You can skip the first several paragraphs until you get to the paragraph that stars with: “Now we’ll build the foreground chart. Start out by building a simple area chart.”  Follow his steps until you get to the paragraph that starts with: “The last step is to add these to a dashboard.”  Enter Kevin.
Up to this point, you’ve built a transparent area chart, with another, white area chart puzzle-pieced on top of it.  In both Ken and my approaches, you would then float this chart on top of a background which would show through the lower, transparent area chart and be “blocked” by the top, white area chart.  His method calls for data densification and can be a bit intense.  My method calls for Siri. 
Hey Siri, find gradient background images”. 
Seriously.  Do a Google search for gradient color background images.  You’ll find a ton of them.  Some are random and some consistent which can provide some bit of context in your chart.  One site in particular, https://webgradients.com, has a ton of free gradient backgrounds for you to use.  I found the following and downloaded it:

The really nice thing about Ken’s approach is that his background was a chart with the same axes as the area chart.  This means that if he floated the area chart on top of the background chart and set them to the same exact size, lining them up would be a cinch.  When using an actual downloaded image as a background, lining them up is not as easy.  For that reason, I suggest going back to the area chart and changing both axes to have a border around them.  Just go to the color card for all axes and change the border to be black (we will remove this later). 

My background image is pretty close to square.  But, I don’t want my area chart to be square, so it is best to make that image rectangular before adding it to the dashboard.  You could crop it, but you will lose some of the gradient color, so I suggest (per the usual), cleaning it up in PowerPoint.  Simply add the image to a slide then squish down the size.  Below is a gif to show you how to do that:

Finally, float the image onto the dashboard.  Then float your area chart on top of it.  All you need to do is to line up the black borders of the area chart with the image behind it.  As a little trick, you can change the shading on the axes to match the background (white in this case) to block any of the image that might be protruding out.  Then go back and remove the black borders from the area chart.  Below is the final result.
In the final paragraph of Ken’s blog post, he says the following:

“Okay, so that is a lot of work just to get a gradient color on an area chart and, ultimately, it’s probably not worth the effort. But there could be cases where having such coloring might be of value, so now you have a method for doing it. Of course, as always, I’d stress you not to use this just because it’s cool. Always consider your use case, your data, and your audience when choosing charts to use in a visualization.”
I agree with everything Ken said, except that using an image is not really not that much work.  Ken’s technique is a lot better at providing context, is easier to line up, and is probably simply a better solution, but my technique simply takes a lot less time and less technical prowess to accomplish.  In addition, one of the things that I love about using images is their flexibility.  In my No Polygons Continued blog post, I wrote about the fact that the no polygon technique is so powerful because you are not limited to shapes (which you are when using actual polygons), you can use actual images…a photo, a pattern, anything you want.  The same thing applies here. 
So, how about some crosshatching? 

Just create find a crosshatching image (or make one yourself in PowerPoint) and add it as the background.


Or how about some crazy stuff? 




This technique is flexible to use any background, color, image, photo…anything.  You could even do something like this to show a little brotherly love:

So there you have it, a gradient…or should I call it, a background area chart!  If you would like to view or download the workbook containing these examples, you can do so here (an image is also below).



In Ken’s blog post, he also talks about doing this with a bar chart.  This also could be done with a background image, but the bars could not have any space between them…like what a histogram might look like…because the calculation would only create an opaque area above the bar, not between them.  And here’s where Ken’ mops the floor with my silly background images. 

Okay, now it’s time for a reality check.  There may be some uses cases where a gradient color chart would be needed and in those limited number of use cases, Ken’s technique or my variation may be useful.  However, the use of photos of water within your area chart…well that is simply to make a visualization look cool and rarely should that be our motivation.  Overall, I implore you to use these techniques with care.

So Ken, there ya have it.  My response to your challenge is certainly less technical, but it does have its advantages in that you can use any photo as a background that you like, even one of two bald twins at the greatest conference on Earth!  Thanks for the challenge, Ken…maybe we can do it again sometime (hint hint).


Kevin Flerlage, February 19, 2019 | Twitter | LinkedIn | Tableau Public

1 comment:

Powered by Blogger.