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.

Integer Values on Line Chart Category Axis

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

There has been a lot of discussion here lately about XY and Line charts:

Many of these posts have described differences between XY and Line charts. One difference that’s been mentioned but not examined is that an XY axis recognizes the complete numerical value of its X data, while a line chart only recognizes whole number (integer) categories. Even if you use a Date-Scale X axis in a line chart, the dates are treated as categories, and you can only plot a point on a date, not on a time between midnight and midnight.

To investigate the behavior further, let’s look at fractional data, that is, dates with times. This data set contains a few points per day (midnight, noon, 6pm; not uniformly spaced) over several days.

Time-Date Data

The XY chart plots the X values perfectly proportionally to the values of time between the points.

The line chart with a category axis spaces the points uniformly in the horizontal direction, despite the not-quite-uniform spacing of the X data, because the category-type axis treats the dates and times merely as text labels, without any intrinsic numerical value.

The line chart with a date-scale axis is an interesting case, because all points for a given date are plotted at midnight at the beginning of that date. This is because the X axis is a category axis after all, and the integer values of the date-time X values, that is, the dates, are used as the numbers of the categories.

If the data is plotted twice in a combination chart, first as a line chart series to provide the line chart date-scale axis, second as an XY chart series, we see both behaviors at once.

In Line-XY Combination Charts I described how to make a Line-XY Chart that used a line chart’s “nice” date-scale axis. The same technique is used in the previous chart. Although the category axis is defined by the line chart series, the XY series is not constrained by the whole-number-only restriction.

Excel 2007 Note: This behavior is broken in Excel 2007. A Line-XY Combination chart using a date scale axis imposes the whole-number-only restriction on the XY series. You can still make the combo chart work, but the XY series must remain on the secondary axis, which means (a) you must manually make sure that the primary and secondary axes agree, and (b) the secondary axis is no longer available for other effects you may have wanted to apply.

If you want to make a combination chart that uses an XY series in conjunction with a chart type that uses a Category-type X axis (Line, Column, Area), knowing that the category labels have effective X values of 1, 2, 3, etc., makes it easy to position the XY data points. Suppose I have a column chart with quarterly data, and I want a target line. The quarterly data is shown in columns A and B below, and the data for an XY series that shows the target is shown in columns D and E. The X value of 0.5 is where the left edge of the chart is located (the axis crosses between categories zero and 1), and the X value of 4.5 is 4 categories further right of the first point.

Start with a column chart.

Copy the XY series data, select the chart, use Paste Special to add the data as a new series.

Right click on the new series, and change the series chart type to an XY type (not a line). Usually Excel will provide secondary axes for the new series, depending on the chart types of existing series in the chart.

Format the series so it is plotted on the primary axes. Note the endpoints coincide exactly with the edges of the chart.

Format the XY series so it has a line only, no markers (this could have been done by choosing the XY chart subbype that uses lines and no markers). Adjust the legend or remove it altogether. Add a data label to one or both points of the XY series using the Y Value option if desired.

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.

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.