Peltier Technical Services, Inc.
 

Excel Charting Utilities | Custom Solutions | Training | Charts and Tutorials | PTS Blog


Peltier Tech
Chart Utilities

PTS Waterfall Chart Utility
PTS Cluster-Stack Column Chart Utility
PTS Box and Whisker Chart Utility
PTS Marimekko Chart Utility
PTS Dot Plot Utility
PTS Cascade Chart Utility

 

Excel Dashboards

 

Books at Amazon.com

 

Buy me a coffee

If this topic or the whole site has been helpful, please support further development by treating me to a cup of coffee.

 

XY Area Chart: Fill Below an XY Series.

This example does not work as shown in Excel 2007. Microsoft has changed the way that a chart with category series (line, area, and column series types) behaves when it also includes XY data. I suspect the change was unintentional, and I hope it will be changed before the version after 2007 is released.

I have posted an updated tutorial on my blog, in Fill Below an XY Chart Series (XY-Area Combo Chart).

Did you ever want to fill the area under an XY chart series? You tried an Area chart, but that didn't work; the X axis didn't scale properly, and you couldn't get the lines and markers you wanted. You can fill the area under an XY series by using a combination XY - Area chart, plus a little creative treatment of the X values of the Area series and of the scaling of the secondary X axis.

I used the following sample data in A1:D11. A3:A10 holds my XY Series X data, B3:B10 holds my XY Series Y data, B2 holds my XY Series name. C2:C11 holds my Area Series X data, D2:D11 holds my Area Series Y data, D1 holds my Area Series name.

   |     A       B       C       D
---+--------------------------------
 1 |                           Area
 2 |          Values    134      0
 3 |   2.00     37      134     37
 4 |   3.27     31      219     31
 5 |   6.26     19      418     19
 6 |   7.58     42      506     42
 7 |   8.33     14      556     14
 8 |   9.79     41      654     41
 9 |  11.20     29      748     29
10 |  13.86     25      925     25
11 |                    925      0

The data in A:B is the "regular" data; that in C:D is derived with formulas. D3:D10 simply point back to B3:B10, while D2 and D11 are zero. The formula in C3 is:

=INT(1000*A3/15 + 1.5)

or more generally:

=INT(1000*(A3-Xmin)/(Xmax-Xmin) + 1.5)

where Xmin and Xmax are the min and max of the X axis for the data (0 and 15 for this sample data). This formula rescales the X axis range to run from 1 to 1001 for the area chart; I could have used ROUND in place of INT and the extra .5 in the formula, but I thought of this approach first. The formula in C3 is dragged down to fill C3:C10. C2 has the formula =C3, and C11 has the formula =C10, so the first and last values are repeated, to line up with the zeros added in D2 and D11.

Select A2:B10 and make an XY chart.

Add the Area data as a new series. Select and copy C1:D11, select the chart, and Paste (Ctrl-V is the easiest way here, or use Paste Special from the Edit menu to add the data as new series). The two series in our chart do not line up at all, but we'll fix that in a minute.

Before you panic about the scaling, right click on the new series, choose Chart Type from the popup menu, and pick an area chart style.

Double click on the area series, and on the Axes tab, select Secondary. At this point, on the Patterns tab I also changed the fill color of the Area series, and set the border to None.

Right click on the chart, choose Chart Options, and on the Axes tab, check the Secondary Category X Axis, and select the Time Scale option. Excel automatically puts the new category axis at the top of the chart, so everything above the XY series is filled. Or it would be if we had lined it up yet.

Double click the secondary horizontal axis (top of the chart), and on the Scale tab, set the minimum to 1 and the maximum to 1001 (replace the dates), and set Base Unit = Days. On the Patterns tab, choose None for Major and Minor Tick Marks and Tick Mark Labels. The area series now fits the XY series perfectly, above the XY series.

Double click on the secondary Y axis (right side of the chart), and UNcheck the Category (X) Axis Crosses at Maximum Value box.

Finally, right click on the chart, select Chart Options, and on the Axes tab, UNcheck the Secondary Y Axis box.

To fill the area between two XY series, use the modification of the above technique on this page: XY Area Chart: Fill Between XY Series.

 

 

Page copy protected against web site content infringement by Copyscape

 

PTS Waterfall Chart Utility PTS Cluster-Stack Column Chart Utility PTS Box and Whisker Chart Utility PTS Marimekko Chart Utility PTS Dot Plot Utility PTS Cascade Chart Utility

 

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


Peltier Technical Services, Inc.

Commercial Utilities | Custom Solutions | Training | Charts and Tutorials | PTS Blog

Peltier Technical Services, Inc., Copyright © 2010. All rights reserved.
You may link to this article or portions of it on your site, but copying is prohibited without permission of Peltier Technical Services.

Microsoft Most Valuable Professional

Microsoft Most Valuable Professional

My MVP Profile