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.

 

Area Combination Chart for Monthly Temperatures.

In Column Combination Chart for Monthly Temperatures, I showed how to create a stacked column chart which summarized the past month's temperatures. It's an informative chart, and compares each day's minimum and maximum temperature with the normal range and the historical minimum and maximum temperatures for each date. Jack Jordan sent along a similar graphic based on area chart series, and asked if I could reproduce it in Excel.

That isn't actually the scanned chart he sent me, it's my reproduction in Excel of the chart he sent, in all of its colorful glory. If I apply the colors of my original stacked column chart, it looks pretty good:

The chart looks complicated, but it can be broken down into smaller components:

  • Floating/Stacked Areas* for the Record High/Low and Normal Range series,
  • Floating/Stacked Areas* for the Daily Range series (on the secondary axis),
  • Line series for special highlighting of Monthly Min/Max,
  • XY series for legend-type labels along the right edge of the chart.

*Floating/Stacked Area Charts are very similar in data layout and chart construction to Floating/Stacked Column Charts.

The Data

The important daily temperature data is shown below. I wish I could tell you where to download it from, but I don't know; instead I manually digitized the chart from the newspaper.

  A B C D E F G
1 Boston Temperatures, April 2006      
2 Boston Globe, Sunday, May 7, 2006      
3              
4 Date Record Low Record High Normal Low Normal High Daily Low Daily High
5 1-Apr-06 13 76 36.0 51.0 49 70
6 2-Apr-06 19 75 36.3 51.3 47 64
7 3-Apr-06 21 77 36.6 51.7 39 52
8 4-Apr-06 17 75 36.8 52.0 37 51
9 5-Apr-06 11 84 37.1 52.4 33 39
10 6-Apr-06 20 82 37.4 52.7 35 53
11 7-Apr-06 16 86 37.7 53.1 37 61
12 8-Apr-06 21 86 37.9 53.4 38 53
13 9-Apr-06 24 85 38.2 53.8 36 44
14 10-Apr-06 26 85 38.5 54.1 38 57
15 11-Apr-06 25 78 38.8 54.4 39 58
16 12-Apr-06 20 85 39.0 54.8 41 69
17 13-Apr-06 20 86 39.3 55.1 55 69
18 14-Apr-06 26 81 39.6 55.5 45 68
19 15-Apr-06 28 82 39.9 55.8 47 77
20 16-Apr-06 28 82 40.1 56.2 46 59
21 17-Apr-06 26 82 40.4 56.5 43 53
22 18-Apr-06 26 93 40.7 56.9 46 64
23 19-Apr-06 22 87 41.0 57.2 49 73
24 20-Apr-06 21 89 41.2 57.6 45 64
25 21-Apr-06 21 88 41.5 57.9 43 49
26 22-Apr-06 26 88 41.8 58.2 39 48
27 23-Apr-06 29 85 42.1 58.6 43 48
28 24-Apr-06 28 82 42.3 58.9 44 48
29 25-Apr-06 27 83 42.6 59.3 43 70
30 26-Apr-06 28 85 42.9 59.6 38 60
31 27-Apr-06 33 92 43.2 60.0 43 55
32 28-Apr-06 30 90 43.4 60.3 40 50
33 29-Apr-06 31 85 43.7 60.7 39 55
34 30-Apr-06 30 85 44.0 61.0 40 56

In order to generate floating and stacked area series, we need to make adjustments to the data. The new data for the Record High/Low and Normal Range series must include a hidden series on which the others float (using the Record Low value), a series containing the difference between Normal Low and Record Low, a series containing the Normal Range (the difference between Normal High and Normal Low), and a series containing the difference between Record High and Normal High. The new data for the Daily Range needs a hidden series (the Daily Low) and a series showing the Daily Range (the difference between Daily High and Daily Low). The circles around the month's High and Low require two more series that only have plottable data for the actual high and low data points. The transformed data is shown here:

  A H I J K L M N
1 Boston Temperatures, April 2006        
2 Boston Globe, Sunday, May 7, 2006        
3                
4 Date Bottom Below Normal Above Range Monthly Low 33°F Monthly High 77°F
5 1-Apr-06 13 23.0 15.0 25.0 21 #N/A #N/A
6 2-Apr-06 19 17.3 15.1 23.7 17 #N/A #N/A
7 3-Apr-06 21 15.6 15.1 25.3 13 #N/A #N/A
8 4-Apr-06 17 19.8 15.2 23.0 14 #N/A #N/A
9 5-Apr-06 11 26.1 15.3 31.6 6 33 #N/A
10 6-Apr-06 20 17.4 15.3 29.3 18 #N/A #N/A
11 7-Apr-06 16 21.7 15.4 32.9 24 #N/A #N/A
12 8-Apr-06 21 16.9 15.5 31.6 15 #N/A #N/A
13 9-Apr-06 24 14.2 15.6 31.2 8 #N/A #N/A
14 10-Apr-06 26 12.5 15.6 30.9 19 #N/A #N/A
15 11-Apr-06 25 13.8 15.7 23.6 19 #N/A #N/A
16 12-Apr-06 20 19.0 15.8 30.2 28 #N/A #N/A
17 13-Apr-06 20 19.3 15.8 30.9 14 #N/A #N/A
18 14-Apr-06 26 13.6 15.9 25.5 23 #N/A #N/A
19 15-Apr-06 28 11.9 16.0 26.2 30 #N/A 77
20 16-Apr-06 28 12.1 16.0 25.8 13 #N/A #N/A
21 17-Apr-06 26 14.4 16.1 25.5 10 #N/A #N/A
22 18-Apr-06 26 14.7 16.2 36.1 18 #N/A #N/A
23 19-Apr-06 22 19.0 16.2 29.8 24 #N/A #N/A
24 20-Apr-06 21 20.2 16.3 31.4 19 #N/A #N/A
25 21-Apr-06 21 20.5 16.4 30.1 6 #N/A #N/A
26 22-Apr-06 26 15.8 16.4 29.8 9 #N/A #N/A
27 23-Apr-06 29 13.1 16.5 26.4 5 #N/A #N/A
28 24-Apr-06 28 14.3 16.6 23.1 4 #N/A #N/A
29 25-Apr-06 27 15.6 16.7 23.7 27 #N/A #N/A
30 26-Apr-06 28 14.9 16.7 25.4 22 #N/A #N/A
31 27-Apr-06 33 10.2 16.8 32.0 12 #N/A #N/A
32 28-Apr-06 30 13.4 16.9 29.7 10 #N/A #N/A
33 29-Apr-06 31 12.7 16.9 24.3 16 #N/A #N/A
34 30-Apr-06 30 14.0 17.0 24.0 16 #N/A #N/A

The formulas required to construct this range are summarized below. The formulas in H5:N5 are filled down to H34:N34.

Column Name

Cell Range

Formula in Top Cell of Range

Bottom

H5:H34

=B5

Below

I5:I34

=D5-B5

Normal

J5:J34

=E5-D5

Above

K5:K34

=C5-E5

Range

L5:L34

=G5-F5

Monthly Low

M4 only

="Monthly Low "&TEXT(MIN($F$5:$F$34),"0°F")

M5:M34

=IF(F5=MIN(F$5:F$34),F5,NA())

Monthly High

N4 only

="Monthly High "&TEXT(MAX($G$5:$G$34),"0°F")

N5:N34

=IF(G5=MAX(G$5:G$34),G5,NA())

The formulas in M4 and N4 concatenate the label and value; these will become the series names, and the series will be labeled using the Series Name option. The formulas in columns M and N below these labels assure that only the maximum and minimum will appear in the chart; NA() produces an ugly #N/A error in the sheet, but a Line or XY chart ignores this when plotting points.

Finally, we need special data for the series which will be used for the labels along the right edge of the chart. The range is shown below, along with the formulas which define these values.

  P Q R
1      
2 30-Apr-06    
3      
4   Record  
5 30-Apr-06 30 Record Low
6 30-Apr-06 85 Record High
7 30-Apr-06 53.7 Normal Range
8   52.5 uncorrected
9 #N/A 44 Normal Low
10 #N/A 61 Normal High
11      
12   Daily Range  
13 30-Apr-06 46.8  
14   48.0 uncorrected
15   40 Daily Low
16   56 Daily High
17      
18   11 Record Low
19   93 Record High
20   12 Divisor

Cell(s)

Formula

P2

=MAX($A$5:$A$34)

P5:P7

=$P$2+0.5

Q5

=VLOOKUP($P$5,$A$5:$G$34,2)

Q6

=VLOOKUP($P$5,$A$5:$G$34,3)

Q7

=IF(ABS(Q8-Q14)>(Q19-Q18)/Q20,Q8,(Q8+Q14)/2+IF(Q8>Q14,(Q19-Q18)/(2*Q20),-(Q19-Q18)/(2*Q20)))

Q8

=(Q9+Q10)/2

Q9

=VLOOKUP($P$5,$A$5:$G$34,4)

Q10

=VLOOKUP($P$5,$A$5:$G$34,5)

P13

=$P$2+0.5

Q13

=IF(ABS(Q8-Q14)>(Q19-Q18)/Q20,Q14,(Q8+Q14)/2+IF(Q8>Q14,-(Q19-Q18)/(2*Q20),(Q19-Q18)/(2*Q20)))

Q14

=(Q15+Q16)/2

Q15

=VLOOKUP($P$5,$A$5:$G$34,6)

Q16

=VLOOKUP($P$5,$A$5:$G$34,7)

Q18

=MIN($B$5:$B$34)

Q19

=MAX($C$5:$C$34)

Q20

Factor selected to move labels appropriate amount only if necessary

The lookup formulas in column Q are more intricate than necessary (as are those in column P), but they allow rapid scaling up if the data were converted to a dynamic range. They determine the latest value of each of the relevant series, for proper vertical alignment of the labels. Note that these formulas refer to a range ending in row 34, but for a 31 day month these should be changed to row 35. Even better would be using dynamic names for these ranges, or converting the worksheet range to a "List" if using Excel 2003.

The uncorrected label positions in Q8 and Q14 in the original version of this page may cause the "Normal Range" and "Daily Range" labels to overlap. The complicated formulas in Q7 and Q13 and the factor in Q20 allow for moving of these labels if they would overlap on the chart.

Making the Chart

The first step is to make a stacked area chart from the historical data. Select A4:A34 (Date), then hold Ctrl while selecting H4:K34 (Bottom, Below, Normal, and Above). Start the chart wizard, and create a Stacked Area chart. (Don't make a Stacked 100% Area chart.)

The chart has my usual plot area formatting: black border, white fill, and light gray gridlines.

Make the Bottom series invisible: double click on the series, and on the Patterns tab of the Format Series dialog, choose None for Area and for Border. Double click on the Below series and choose light gray for Area and None for Border. Format the Above series the same, by selecting it and pressing the F4 function key (the shortcut for Repeat Last Action). Format the Normal series with a medium gray for Area and None for Border. Other adjustments at this point included deleting the legend and formatting the X axis major spacing to 7 days. This is starting to look like a chart.

Note: for my light gray color, I used a custom color in the Excel color palette. I went to the Tools menu > Options > Color tab, clicked on the "dark yellow" square (the greenish-brown square, third from the left in the second row), clicked on Modify, and selected the third lightest gray on the custom color tab. I used the lightest gray on Excel's palette (just above the white square) as my medium gray color.

Now the Daily High and Low data is added to the chart. Select F4:F34 (Daily Low), hold Ctrl while selecting L4:L34 (Range), and copy (Ctrl+C or Copy from the Edit menu). Select the chart, and choose Paste Special from the Edit menu. Choose New Series, Values in Columns, and Series Names in First Row.

Move these two added series to the secondary axis, so they will appear in front of (not stacked on top of) the series created earlier. Double click one of the series, and on the Axis tab, select Secondary. Select the other series, and press the F4 function key (the shortcut for Repeat Last Action).

You don't need the Y axes on both sides of the chart, especially since different default scales will make maintenance of the chart more tedious. Remove the secondary Y axis: select Chart Options from the Chart menu, click on the Axes tab, and uncheck the Secondary Y Axis box. Now all series use the primary axis for their scaling, but they retain their separation between primary and secondary axis groups.

Now format these series to look like a single floating area. Make the Daily Low series invisible: double click on the series, and on the Patterns tab of the Format Series dialog, choose None for Area and for Border. Double click on the Range series and choose an appropriate color (I used orange to match the chart in the newspaper) for Area and None for Border.

Add the series which will indicate the month's minimum and maximum temperatures. Copy M4:N34 (Monthly Low and Monthly High), select the chart, and choose Paste Special from the Edit menu. Choose New Series, Values in Columns, and Series Names in First Row.

These were added as more stacked area series. Select one of these series, and using Chart Type on the Chart menu, change its chart type to Line. Select the other series and press the F4 function key. Double click one series; on the Patterns tab of the Format Series dialog, select None for Line and a large (size 7) circle with black (for example) as its Foreground and No Color for its Background; on the Data Labels tab, check the Series Name option. Select the other line series and press the F4 function key. Double click on the Monthly High data label, and on the Alignment tab, choose Above for Label Position. Double click on the Monthly Low data label, and on the Alignment tab, choose Below for Label Position.

Add the series that will locate the descriptive labels. Copy P4:Q7 (Record, highlighted in blue), select the chart, and choose Paste Special from the Edit menu. Choose New Series, Values in Columns, Series Names in First Row, and Categories (X Labels) in First Column. Copy P11:Q12 (Daily Range, highlighted in green), select the chart, and choose Paste Special from the Edit menu. Choose New Series, Values in Columns, Series Names in First Row, and Categories (X Labels) in First Column. Since the last series was converted to a line series, these series are added as line series; Record is shown in blue and Daily Range in green.

To align these series along the right edge of the chart, they need to be converted to XY series. Select one of these series, and using Chart Type on the Chart menu, change its chart type to XY (Scatter). Select the other series and press the F4 function key.

Add labels to the series, then make the points invisible. Select the Daily Range series, and on the Data Labels tab, select the Series Name option; on the Patterns tab, select None for Line and Markers. For the Record series, there are three choices:

  • Add Series Name labels as above, then manually change the text of each label to the text you want.
  • Add Series Name labels, then link the labels to the cells as follows: select an individual label (denoted by a gray rectangle around the label, which may take two clicks), then type = in the Formula Bar, and click on the cell with the mouse. This produces a link like =Sheet1!$R$7 which forces the label to update when the cell updates.
  • Download Rob Bovey's Chart Labeler from http://appspro.com or John Walkenbach's Chart Tools from http://j-walk.com. Both are free Excel add-ins, easy to install and use. These add-ins allow you to apply linked cell values to the data labels of a chart series, in a much less tedious way than above.

I've used orange and gray font colors so the labels are more clearly associated with the historical series in the chart.

Temperatures Above and Below Zero

My chart shows temperatures in Boston using the Fahrenheit scale, where temperatures below zero are very rare. Jack's data set had a twist that I hadn't encountered in mine: his temperatures were for a location in Canada using degrees Celcius, so he had positive and negative temperature values. The nice thing about using stacked area series is that no modifications are needed to depict negative temperatures in this chart.

The only modification that might be necessary is to move the X axis. If you like the axis to serve as a marker for 0°, then no change in needed. If you want the X axis at the bottom of the chart, double click the Y axis. On the Scale tab, enter an appropriate value in the Category (X) Axis Crosses At box. You could either enter the exact value where you want the axis to cross, or to be sure it will always cross at the bottom, enter a value that is less than you ever expect to need; I used -100. Since this value is less than the axis minimum, Excel just uses the axis minimum.


There are two versions of this chart which use columns rather than areas to display the temperature data.


Column Chart for Positive Temperatures


Column Chart for Positive and Negative Temperatures

 

 

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