Peltier Tech Blog

Excel Chart Add-Ins | Training | Custom Solutions | Charts and Tutorials | PTS Blog

 

Main menu:

 
Peltier Tech
Chart Add-Ins

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

Subscribe

Site search

Subscribe

Site search


Recent Posts

Recently Commented

Popular Posts

Archive


 

Categories


 

Privacy Policy

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

Individually Formatted Dual Category Labels

by Jon Peltier
Monday, June 15th, 2009
Peltier Technical Services, Inc., Copyright © 2010.
Licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License.

In Chart with a Dual Category Axis I showed how to make a chart with dual category labels (two rows of labels). In Individually Formatted Category Axis Labels I showed how to format axis labels individually by ignoring the built in labels and using an invisible series with individually formatted data labels. An attentive reader asked how to format the individual labels in a dual axis category axis, and the answer is: combine these two methods.

We’ll use the same data as in the original post.

Dual Category Axis Chart Data

Make a column chart using the data in columns C:E, ignoring the axis labels for now.

Chart with Generic Counting Number Axis

Format the axis to hide the default axis tick labels (but remember the sequence: 1, 2, 3, etc.).

Chart with No Axis Showing

Here is the data for the dummy (hidden) series that will provide our labels. The first block is for the puter labels: the X values are in column G, corresponding to the slots in the category axis which were numbered for us in the first chart above; the Y values (zeros) are in column H; and the labels are in column I. I’ve kept all of the rows in this first block just so the labels were aligned and I could use simple formulas.

The numbers 2, 6, and 10 in column G refer to the slots that these labels will be centered under; if any of the groups had an even number of points, we would have had to center the outer labels between two axis slots, by using an X value of (for example) 9.5. Since we’ll be making XY series of these sets of data, we could use non-integer X values if necessary.

The labels use a simple formula to insert a line feed before the text of the original label; the line feed positions these outer labels below the inner labels. The formula in cell I2 is

=CHAR(10)&A2

and this is copied down as needed. It can be used in all cells, since a line feed plus an empty string will not look like anything in the chart.

The second block, for the inner labels, is configured in the same way as the first.

Data for Hidden Series with Data Labels

Add the first dummy series by copying G1:H12, selecting the chart, and using Paste Special to add the data as a new series. The new series is not visible in the chart, because it is added as another stacked column with values (heights) of zero.

Select a visible series in the chart, and use the up arrow until the added series (“Outer Labels”) is selected. Right click on one of the selection indicators, and if the context menu has an item called Format Data Series, choose Chart Type, and select the XY type with markers but no lines. The series is indicated below as large red squares.

Chart with Added XY Series

Excel helpfully placed the XY series onto the secondary axis. Select the XY series, press CTRL+1 (numeral one) to open the Format Series dialog, and change its axis to Primary. See how well it is aligned.

Added XY Series Moved to Primary Axis

Now add data labels to this series. The easiest way is to download and install Rob Bovey’s Chart Labeler. The Chart Labeler is free and easy to use. It installs a submenu to the Tools menu, as shown below (in Excel 2007 it adds an item to the Add-Ins ribbon tab).

Chart Labeler Menu

In the dialog, select the series, select the range containing the labels, and select the position of the labels.

Chart Labeler Dialog for Added XY Series

Here is the chart with the outer labels.

XY Series with Data Labels

Add the second series. Copy K1:L12, select the chart, and use Paste Special to add this data as a new series. Since the previously added series was converted to an XY series and moved to the primary axis, this chart is conveniently pasted as an XY series on the primary axis, indicated by green diamonds below.

Chart with Second Added XY Series

As above, use the Chart Labeler to label the Inner Labels series.

Chart Labeler Dialog for Second Added XY Series

Here is the chart with all category labels showing.

Second XY Series with Data Labels

Hide the XY series by formatting them to show no lines and no markers.

Hide XY Series (No Markers, No Lines)

Select an individual label (the first click selects the series of labels, the second selects the label itself), and format it as desired. When one label is selected, you can use the left and right arrow keys to move to adjacent labels. In Excel 2003 and earlier, the F4 key will assign the last applied format to the selected label.

Select Data Label and Apply Format

Here is the chart with its category labels formatted to match the plotted data. The color used for the font is a darker variation of the fill color used for the columns; it looks like these could be even a bit darker.

Chart with Dual Individually Formatted Category Axis Labels


Related Posts:

Bookmark and share this entry:
  • Twitter
  • Digg
  • Facebook
  • LinkedIn
  • del.icio.us
  • Technorati
  • StumbleUpon
  • Google Bookmarks
  • Reddit
  • MySpace
  • Slashdot
  • Yahoo! Buzz
  • Tumblr

Learn how to create Excel dashboards.

Comments


Comment from Liu ’s chart blog
Time: Monday, June 15, 2009, 10:07 am

maybe you dont need to use the xy chart and the labelers changer?
use a col of 0 to draw a line , set the line serial’s data label = the category ,it’s the same


Comment from Jon Peltier
Time: Monday, June 15, 2009, 10:32 am

Liu -

Good point, this is a simpler way to handle the inner labels. The added series has to be a line chart type, and it has to use only the inner label column for its category labels. You then need to add another series for the outer labels.


Comment from Lois Huang
Time: Tuesday, June 16, 2009, 3:44 am

I don’t understand your way to add chart label, but I find another way, I name the chart title “mechanic”, X-axis “electrical” and Y-axis “hydraulic”, then move them down in a line under the X-axis, so the titles turn to be labels,you can format them easily.
The question is that you need to be very careful to place them on the same line. Is there any better way for this question?


Comment from Jon Peltier
Time: Tuesday, June 16, 2009, 5:24 am

The better way is the way I showed in the chart. Try again and follow all of the steps carefully. What do you get which is different than what I get?


Comment from mark
Time: Wednesday, September 9, 2009, 7:29 pm

Take your chart- I want to change the appearance of the data labels on y axis to read:2-3 days; 3-5days; 6-10 days, etc instead of values you have. the underlying dats does not change, just the scale point names change –
I’d rather not get into VBA coding –
and I am under a tight deadline.


Comment from Jon Peltier
Time: Thursday, September 10, 2009, 7:48 am

Mark -

Change the text in the cells that the added data labels reference.


Comment from So,pm
Time: Wednesday, September 23, 2009, 4:00 pm

Just what I was looking for.
Thanks!


Comment from Daniel
Time: Monday, November 23, 2009, 9:39 am

Jon, You’re the man!

Is there a way to apply this to pivot charts?


Comment from Jon Peltier
Time: Monday, November 23, 2009, 11:23 am

Daniel -

Pivot charts do not allow you to add data to a chart unless the data came from the pivot table. So you can’t add the dummy series needed to supply the formatted labels.

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 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

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