www.delorie.com/gnu/docs/emacs-lisp-intro/emacs-lisp-intro_273.html   search  
 
Buy the book!


Programming in Emacs Lisp

[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

C.2 The print-Y-axis Function

The job of the print-Y-axis function is to print a label for the vertical axis that looks like this:

 
    10 -




     5 -



     1 -

The function should be passed the height of the graph, and then should construct and insert the appropriate numbers and marks.

It is easy enough to see in the figure what the Y axis label should look like; but to say in words, and then to write a function definition to do the job is another matter. It is not quite true to say that we want a number and a tic every five lines: there are only three lines between the `1' and the `5' (lines 2, 3, and 4), but four lines between the `5' and the `10' (lines 6, 7, 8, and 9). It is better to say that we want a number and a tic mark on the base line (number 1) and then that we want a number and a tic on the fifth line from the bottom and on every line that is a multiple of five.

What height should the label be?  What height for the Y axis?
C.2.1 Side Trip: Compute a Remainder  How to compute the remainder of a division.
C.2.2 Construct a Y Axis Element  Construct a line for the Y axis.
C.2.3 Create a Y Axis Column  Generate a list of Y axis labels.
C.2.4 The Not Quite Final Version of print-Y-axis  A not quite final version.


  webmaster   donations   bookstore     delorie software   privacy  
  Copyright 2003   by The Free Software Foundation     Updated Jun 2003