Thursday, October 25, 2007

Finally figured out how to do a cluster/stacked column chart in Excel 2007

I got confused about the instructions here.
I couldn't figure out at a high level what the steps were about. Now that I better understand what's going on, here's the conceptual idea of what's going on:

  • We first select a dummy table of data that contains only the labels we want to use on the horizontal axis. All values are 0 so this can be shown on the graph without actually changing the view of the data we really want to see.

  • We then copy in all the data we really want to use. Map that data to be plotted on a secondary axis. We want the secondary axis for this info since the tick marks for secondary data always show by default at the top of the chart (you can change this, but it doesn't quite line up).

  • We also change the overlap of each data bar to be 0 so we get the look we're going for.

  • Explicitly ask for the Secondary Axis to be shown so that it behaves as we expect.

  • Adjust the selected data so that the first blank row of data is used (for spacing purposes).

  • Go to the HORIZONTAL axis options dialog and change the secondary VERTICAL access to appear Low (that is to the left, stupidest UI I've ever seen...). Vice versa for the primary vertical axis.

  • Hide the appropriate tick marks and data labels for the axis we're not using.

Here are the semi-step by step instructions:
1. Select the small table of data you want to use for the blank horizontal axis and create a Stacked Column Chart from that data (see example file here).

2. Now select the real data you want to use and paste in the data into the chart we just created.

3. Select one of the data bars that has real data, and then right click. Select Format Data Series...

4.Change Gap Width to be 0%. Choose to Plot Series On: Secondary Axis. Click OK.

5. Do this for the rest of all the "real" data bars (you will only have to the Plot part).

6. Go to Chart Tools, Layout, Axes, Secondary Horizontal Axis, Show Left to Right Axis. Now things should be looking better (real axis on the bottom, fake one on top).

7. Right click again on one of the real data series. Choose Select Data...

8. Click each of the Legend Series can contains real data (not the dummy one) and edit the "Series name" so that it doesn't include the first blank row. Also adjust the "Series values" to INCLUDE the first blank line. Do this for all of your columns of data.

9. Go to Chart Tools, Layout, Axes, Primary Horizontal Axis, More Primary Horizontal Axis Options.

10. Change the "Vertical axis crosses:" to be "At maximum category". This switches the primary axis to be to the right.

11. Go to Chart Tools, Layout, Axes, Secondary Horizontal Axis, More Secondary Horizontal Axis Options.

12. Change the "Vertical axis crosses:" to be "Automatic". This switches the secondary axis to be to the left.

13. Turn off all unneeded tick marks and labels by changing them to None in the appropriate More Axis Options dialogs.

14. Turn on/off the appropriate horizontal gridelines.

15. Delete the dummy series from the legend.

16. Yikes! That was waaay harder than it should have been.

Wow...

No comments: