Peltier Tech Blog

Excel Chart Add-Ins | Training | Charts and Tutorials | Peltier Tech Blog

 

Main menu:

Peltier Tech Chart Utilities for Excel Peltier Tech Panel Chart Utility Peltier Tech Waterfall Chart Utility Peltier Tech Cluster-Stack Chart Utility Peltier Tech Box and Whisker Chart Utility Peltier Tech Marimekko Chart Utility Peltier Tech Dot Plot Utility Peltier Tech Cascade Chart Utility

 
Excel Dashboards
 

 
Amazon Books
 

Subscribe

Site search

Subscribe

Site search


Recent Posts

Popular Posts

Categories


 

Privacy Policy

Creative Commons License
Licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License.

Area Chart With Gap

 
by Jon Peltier
Tuesday, March 23rd, 2010
Peltier Technical Services, Inc., Copyright © 2012.
Licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License.

In Mind the Gap โ€“ Charting Empty Cells I showed how the various Excel chart types treat blank cells, through various settings like Leave a Gap, Treat as Zero, and Interpolate.

In that article I wrote:

Area charts seem to offer both the zero and interpolation options, but in both cases, the chart plunges to zero without a corresponding data label. If we mess with the vertical axis, the chart still plunges exactly to zero in both cases.

Area Charts, With Empty Cells Treated as Zeros, or Supposedly Interpolated

A more suitable appearance for an area chart would be one that leaves a real gap, with vertical edges, as below. To get this I had to make a two-axis chart, with a hidden series on the primary axis to provide the A-B-C category axis labels, and an area chart on the secondary axis, with two points at the second category (Y=4 and zero) and two at the fourth category (Y=zero and 8). A date scale on the secondary category axis aligns these points above each other to produce the vertical-sided gap. This only took me three minutes to construct, but an average user might never quite get it.

Area  Charts, With Empty Cells Treated as Gaps, if We Had Our Way

How rude of me to hint at an approach, but not to share it!

For this chart appearance, you need a line chart series to provide the visible category axis, and an area chart on a hidden date scale axis to provide the visible area chart. Here is the data range:

Data for Area Chart With Gap Having Vertical Sides

Recall a date scale axis shows multiple Y values on the same category in a vertical line, which will provide the vertical sides to the gap in the area chart. Start by making a line chart with the red-shaded range. Copy the area chart data in the blue range, select the chart, and use Paste Special to add the data as a new series.

Line Chart, with Area Chart Data Added As Another Line

Change the area chart series to an area chart type, then assign the area chart tot he secondary axis.

Area Chart Series Changed to Area Type and Moved to Secondary Axis

Excel probably only provided a secondary Y axis, so add a secondary X axis, using a date scale rather than a category scale. Hide this secondary axis by using no line, no axis tick marks, and no axis tick labels.

Secondary Date Scale Category Axis Added, Then Hidden

Format the secondary Y axis so that the secondary X axis does not cross at the maximum (it will default to zero), then delete the secondary Y axis.

Secondary X Axis Moved to Y=Zero, Secondary Y Axis Deleted

Hide the line chart series by formatting it to have no lines and no markers. Add data labels to the area chart series.

Line Chart Series Hidden, Data labels Added to Area Chart Series

Use a number format like 0;;; for the area chart data labels, to hide labels for zero values.

Data Label Number format Changed to Hide Zero Labels

As I said, it’s easy, if you know how.

Related Posts:

Learn how to create Excel dashboards.

Comments


Comment from dermot balson
Time: Tuesday, March 23, 2010, 5:33 pm

Jon, it may be slightly simpler to
1. replace all blanks with (say) -999999, using a formula
2. format the Y axis to have a minimum of 0


Comment from Jon Peltier
Time: Tuesday, March 23, 2010, 9:02 pm

Dermot -

Yeah, that would work. I think I would always know about the vast reaches of false data down to -999999 though. Me and my OCD.


Comment from Barb
Time: Thursday, March 25, 2010, 2:19 pm

I was attempting to recreate what you have done. But I am unsure how to add a secondary x-axis, excel 2007 can be tricky sometimes!. Could you please explain how to add the second x-axis?


Comment from Jon Peltier
Time: Thursday, March 25, 2010, 2:31 pm

Barb -

Select the chart, then on the middle Chart Tools tab, click Axes, and select the variation you need to add or remove.


Comment from Isik
Time: Thursday, July 28, 2011, 12:01 pm

This is very helpful Jon, thank you. I have an area chart that needs to stack to 100% (http://postimage.org/image/2xga16o6c/), with the years where there are missing data dropping straight to zero like in your post. But I couldn’t get your technique to work with this type of chart – any suggestions?

Thank you very much,

Isik


Comment from Jon Peltier
Time: Saturday, July 30, 2011, 9:56 am

It works the same. In this tutorial, it shows how to convert your horizontal axis to a data-scale axis. It’s okay to still just use years. Excel treats them as days, but format as General or Number with no decimals, and it will look like years.

Now, for the left vertical edge of the gap each series needs two points for that year, the first with the pre-gap values, the next with zeros. For the right vertical edge of the gap, each series also needs two points, the first for zero, the second for post-gap values.


Comment from Isik
Time: Thursday, August 4, 2011, 8:24 am

Perfect! Thank you very much.

Write a comment

I welcome comments from my readers. If you have an opinion on this post, if you have a question or if there is anything to add, I want to hear from you. Whether you agree or disagree, please join the discussion.

If you want to include an image in your comment, post it on your own site or on one of the many free image sharing sites, and include a link in your comment. I'll download your image and insert the necessary html to display the image inline.

Read the PTS Blog Comment Policy.





Subscribe without commenting

Peltier Tech Chart Utilities for Excel Peltier Tech Waterfall Chart Utility Peltier Tech Box and Whisker Chart Utility Peltier Tech Cluster-Stack Chart Utility Peltier Tech Panel Chart Utility Peltier Tech Marimekko Chart Utility Peltier Tech Dot Plot Utility Peltier Tech Cascade Chart Utility

Create Excel dashboards quickly with Plug-N-Play reports.