Ever wanted to make an area chart with up down colors, something like this? Then this tip is for you.
How to create area chart with up / down colors?
Simple. You need,
- Data with positive & negative values.
- optional: A cup of coffee or a cold beverage of your choice.
Start by creating a regular area chart. You will get this:
Now, select the are and go to format settings (use shortcut CTRL+1).
Go to fill color for the area and change it to gradient fill.
Set it to one of the default gradient fills, you will see a screen like this.
The last step: Setting two color gradient
We are nearly there. Take a victory sip out of that coffee cup or cold beverage. First calculate the mid point for our gradient stops. This will be =maximum up value / (maximum up value + maximum absolute down value)
For example, if your data has +5 has maximum positive value and -5 as maximum negative value, then the gradient stop will be 50% since 5 divided by (5+5) is 50%.
Take another sip and set the gradient stops as shown below.
- Create 4 gradient stops (most of the default gradient settings have 4 stops)
- Set stop 1 & 2 to positive color (say blue)
- Stop 3 & 4 to negative color (say red)
- Adjust the position of 2 & 3 to the gradient stop calculation you have done earlier.
- Make sure Gradient is linear with 90 degrees
Done. Your area chart with positive / negative colors is ready. Admire its beauty while finishing your beverage.
Watch video tutorial: Area chart with positive / negative colors
If you are not sure about the whole gradient color trick, check out this video. I explain clearly the idea with few examples (plus there is a bonus trick in there). See it below or head over to my YouTube Channel for it.
Download Example File
Please click here to download a sample file with up down colors for area charts. Play with the data, examine the chart settings to understand this better.
More charting tricks
If you enjoyed this charting trick, there is more where it came from. Check out below examples and spice up your dull chart life.
Cropped chart: When some values are too big
4 Responses to “How to show positive / negative colors in area charts? [Quick tip]”
Thanks, Chandoo, for tutorials. Learned a lot.
Unfortunately could not learn about the running biker.
The link "Target vs. Actual with Biker on a hill chart" has a link to another tutorial.
I would like to see the biker! 🙂
Thanks for letting me know. I fixed the URL error. Here it is - Visualizing target vs. actual progress – Biker on a hill chart
Now I am enlighted!
This only works if the highest value and lowest value are the same. Which makes it kind of pointless. If the goal is to have one colour below 0 and another above, when negative might only go down to -10 and positive up to 50, this will never work. Actually found it to be a waste of time.