Go to the first, previous, next, last section, table of contents.


Final Version of print-Y-axis

The list constructed by the Y-axis-column function is passed to the print-Y-axis function, which inserts the list as a column.

(defun print-Y-axis
  (height full-Y-label-width &optional vertical-step)
  "Insert Y axis using HEIGHT and FULL-Y-LABEL-WIDTH.
Height must be the  maximum height of the graph.
Full width is the width of the highest label element.
Optionally, print according to VERTICAL-STEP."
;; Value of height and full-Y-label-width 
;; are passed by `print-graph'.
  (let ((start (point)))
    (insert-rectangle
     (Y-axis-column height full-Y-label-width vertical-step))
    ;; Place point ready for inserting graph.
    (goto-char start)      
    ;; Move point forward by value of full-Y-label-width
    (forward-char full-Y-label-width)))

The print-Y-axis uses the insert-rectangle function to insert the Y axis labels created by the Y-axis-column function. In addition, it places point at the correct position for printing the body of the graph.

You can test print-Y-axis:

  1. Install
    Y-axis-label-spacing
    Y-axis-tic
    Y-axis-element
    Y-axis-columnprint-Y-axis
    
  2. Copy the following expression:
    (print-Y-axis 12 5)
    
  3. Switch to the `*scratch*' buffer and place the cursor where you want the axis labels to start.
  4. Type M-: (eval-expression).
  5. Yank the graph-body-print expression into the minibuffer with C-y (yank).
  6. Press RET to evaluate the expression.

Emacs will print labels vertically, the top one being `10 - '. (The print-graph function will pass the value of height-of-top-line, which in this case would be 15.)


Go to the first, previous, next, last section, table of contents.