Order of Points in XY and Line Charts
by Jon Peltier
Thursday, July 24th, 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:
- Line Charts vs. XY Charts
- Line-XY Combination Charts
- Category Axis Tricks for Line and Area Charts – 1
- Category Axis Tricks for Line and Area Charts – 2
One interesting thing about a line chart with a date scale X axis is the order of the plotted points. Consider a data set like this, in which the points are out of chronological order.

The line chart internally sorts the data by date, and connects the points in this order, while the XY chart connects them in the order they appear in the sheet.


Here are the same charts as above, with labels on each point indicating the order of each point. Points 1 and 3 of each point are the same, but the other points have different index values depending on the chart type, because the points were out of date order in the worksheet.


I used the following simple procedure to number the points in a series. Select a series, then press Alt-F to pop up the macros dialog (or access the dialog through Tools menu > Macros). Select the macro name from the list, and press run.
Sub NumberThePointsInASeries()
Dim iPt As Long
If TypeName(Selection) = "Series" Then
For iPt = 1 To Selection.Points.Count
With Selection.Points(iPt)
On Error Resume Next
.HasDataLabel = True
.DataLabel.Characters.Text = CStr(iPt)
On Error GoTo 0
End With
Next
Else
MsgBox "Select a series and try again.", vbExclamation
End If
End Sub
Related Posts:
- Line Charts vs. XY Charts
- Integer Values on Line Chart Category Axis
- Candlestick Alternative: Individually Colored Up-Down Bars
- Category Axis Tricks for Line and Area Charts – 1
- Category Axis Tricks for Line and Area Charts – 2
- High-Low Line Alternatives in Excel Charts
- How To: Assign a Macro to a Button or Shape
- Add a Target Line
- Excel Category Axis Types
- Fake Line Chart (Dummy XY Series for X Axis)
Posted: Thursday, July 24th, 2008 under Chart Types.
Comments: none



















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.