;;; chart.el --- Draw charts (bar charts, etc)
-;;; Copyright (C) 1996, 1998, 1999 Eric M. Ludlam
+;;; Copyright (C) 1996, 1998, 1999 Eric M. Ludlam
;; Author: <email@example.com>
;; Keywords: OO, chart, graph
;; Please send bug reports, etc. to firstname.lastname@example.org
-;;; Future versions of Chart can be found at:
;; This package is an experiment of mine aiding in the debugging of
;; eieio, and proved to be neat enough that others may like to use
;; it. To quickly see what you can do with chart, run the command
;; Chart current can display bar-charts in either of two
;; directions. It also supports ranged (integer) axis, and axis
;; defined by some set of strings or names. These name can be
;; automatically derived from data sequences, which are just lists of
;; anything encapsulated in a nice eieio object.
;; Current example apps for chart can be accessed via these commands:
;; `chart-file-count' - count files w/ matching extensions
;; `chart-space-usage' - display space used by files/directories
;; `chart-rmail-from' - who sends you the most mail (in -summary only)
;; If you find the default colors and pixmaps unpleasant, or too
;; short, you can change them. The variable `chart-face-color-list'
;; contains a list of colors, and `chart-face-pixmap-list' contains
;; all the pixmaps to use. The current pixmaps are those found on
;; several systems I found. The two lists should be the same length,
;; as the long list will just be truncated.
;; If you would like to draw your own stipples, simply create some
;; xbm's and put them in a directory, then you can add:
;; to your .emacs (or wherever) and load the `chart-face-pixmap-list'
;; with all the bitmaps you want to use.
-;; PREFERRED: Emacs 19.30 or better, but should work with earlier
-;; versions but without special fonts/colors/pixmaps
(x-margin :initarg :x-margin
(x-width :initarg :x-width
:initform (lambda () (- (window-width) 10)))
(y-margin :initarg :y-margin
(y-width :initarg :y-width
:initform (lambda () (- (window-height) 10)))
(key-label :initarg :key-label
(sequences :initarg :sequences
"Superclass for all charts to be displayed in an emacs buffer")
+(defmethod initialize-instance :AFTER ((obj chart) &rest fields)
+ "Initialize the chart OBJ being created with FIELDS.
+Make sure the width/height is correct."
+ (oset obj x-width (- (window-width) 10))
+ (oset obj y-width (- (window-height) 12)))
:initform "Generic Axis")
"Chart the current storage requirements of Emacs."
(let* ((data (garbage-collect))
- (names '("conses" "free cons" "syms" "free syms"
- "markers" "free mark" "floats" "free flt"
- "strings/2" "vectors"))
- (nums (list (car (car data))
+ (names '("strings/2" "vectors"
+ (nums (list (/ (nth 3 data) 2)
+ (car (car data)) ; conses
+ (car (nth 1 data))
+ (car (nth 2 data))
+ ;(car (nth 5 data)) ; floats are Emacs only
;; Lets create the chart!
(chart-bar-quickie 'vertical "Emacs Runtime Storage Usage"
(defun chart-emacs-lists ()
"Chart out the size of various important lists."
- (let* ((names '("buffers" "frames" "processes" "faces" "x-displays"
+ (let* ((names '("buffers" "frames" "processes" "faces"))
(nums (list (length (buffer-list))
- (length (x-display-list))
+ (if (fboundp 'x-display-list)
+ (setq names (append names '("x-displays"))
+ nums (append nums (list (length (x-display-list))))))
;; Lets create the chart!
(chart-bar-quickie 'vertical "Emacs List Size Chart"