View Single Post
  #12   Report Post  
Posted to microsoft.public.excel.charting
Del Cotter Del Cotter is offline
external usenet poster
 
Posts: 560
Default Del's Quick & Dirty Step Chart (was Re-imagining charting software)

On Wed, 2 May 2007, in microsoft.public.excel.charting,
Jon Peltier said:

"Del Cotter" wrote
"Ordinal" is like Excel's "Time-scale" (and therein lies an interesting
bug/feature/property that's the key to a favourite trick of mine for quick
and dirty step charts)


Ooh, tell us more!


(This works for me using Excel 97 under Windows XP)

Consider the following range

Series1
1 4
2 2
3 8
4 4
5 7
6 9
7 5
8 6

Where the label "Series1" occupies the cell B2, the X range is A2..A9
and the Y range is B2..B9. If you quickly use the Chart Wizard to create
a scatter chart with lines and markers, the Source Data will look like
this:

X Values: =Sheet1!$A$2:$A$9
Y Values: =Sheet1!$B$2:$B$9

So far, nothing surprising. Now if you go in and manually edit the range
(first remembering that F2 key!) so it looks like this:

X Values: =Sheet1!$A$2:$A$9,Sheet1!$A$2:$A$9
Y Values: =Sheet1!$B$2:$B$9,Sheet1!$B$2:$B$9

(i.e. the same ranges copied twice and separated by a comma)

nothing changes on the scatter graph, except that there is now a line
zipping back to the beginning: the data is just being drawn twice.

Now go in and manually edit the range again so it looks like this:

X Values: =(Sheet1!$A$3:$A$9,Sheet1!$A$2:$A$9)
Y Values: =(Sheet1!$B$2:$B$8,Sheet1!$B$2:$B$9)

(i.e. the X range first part has lost its first row cell, and the Y
range first part has lost its last row cell)

the scatter chart now looks like it has double vision: The line is drawn
across the chart, zips back, and draws itself again displaced one place
to the left.

Now change the chart type to Line, and change the X axis to Time-scale,
and see what you get.

!!

How does it work? Whereas the line in a scatter chart is drawn strictly
in the order the data points appear in the range, the line in a
Time-scale Line chart is drawn from left to right in the order the
points appear on the time-scale!

I expect somebody who knows VBA could turn this into a macro.

--
Del Cotter
NB Personal replies to this post will send email to ,
which goes to a spam folder-- please send your email to del3 instead.