1 ;;; chart.el --- Draw charts (bar charts, etc)
3 ;; Copyright (C) 1996, 1998-1999, 2001, 2004-2005, 2007-2011
4 ;; Free Software Foundation, Inc.
6 ;; Author: Eric M. Ludlam <zappo@gnu.org>
8 ;; Keywords: OO, chart, graph
10 ;; This file is part of GNU Emacs.
12 ;; GNU Emacs is free software: you can redistribute it and/or modify
13 ;; it under the terms of the GNU General Public License as published by
14 ;; the Free Software Foundation, either version 3 of the License, or
15 ;; (at your option) any later version.
17 ;; GNU Emacs is distributed in the hope that it will be useful,
18 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
19 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 ;; GNU General Public License for more details.
22 ;; You should have received a copy of the GNU General Public License
23 ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
27 ;; This package is an experiment of mine aiding in the debugging of
28 ;; eieio, and proved to be neat enough that others may like to use
29 ;; it. To quickly see what you can do with chart, run the command
30 ;; `chart-test-it-all'.
32 ;; Chart current can display bar-charts in either of two
33 ;; directions. It also supports ranged (integer) axis, and axis
34 ;; defined by some set of strings or names. These name can be
35 ;; automatically derived from data sequences, which are just lists of
36 ;; anything encapsulated in a nice eieio object.
38 ;; Current example apps for chart can be accessed via these commands:
39 ;; `chart-file-count' - count files w/ matching extensions
40 ;; `chart-space-usage' - display space used by files/directories
41 ;; `chart-emacs-storage' - Emacs storage units used/free (garbage-collect)
42 ;; `chart-emacs-lists' - length of Emacs lists
43 ;; `chart-rmail-from' - who sends you the most mail (in -summary only)
47 ;; If you find the default colors and pixmaps unpleasant, or too
48 ;; short, you can change them. The variable `chart-face-color-list'
49 ;; contains a list of colors, and `chart-face-pixmap-list' contains
50 ;; all the pixmaps to use. The current pixmaps are those found on
51 ;; several systems I found. The two lists should be the same length,
52 ;; as the long list will just be truncated.
54 ;; If you would like to draw your own stipples, simply create some
55 ;; xbm's and put them in a directory, then you can add:
57 ;; (setq x-bitmap-file-path (cons "~/mybitmaps" x-bitmap-file-path))
59 ;; to your .emacs (or wherever) and load the `chart-face-pixmap-list'
60 ;; with all the bitmaps you want to use.
65 (defvar chart-mode-map
(make-sparse-keymap) "Keymap used in chart mode.")
66 (define-obsolete-variable-alias 'chart-map
'chart-mode-map
"24.1")
68 (defvar chart-local-object nil
69 "Local variable containing the locally displayed chart object.")
70 (make-variable-buffer-local 'chart-local-object
)
72 (defvar chart-face-color-list
'("red" "green" "blue"
73 "cyan" "yellow" "purple")
74 "Colors to use when generating `chart-face-list'.
75 Colors will be the background color.")
77 (defvar chart-face-pixmap-list
78 (if (and (fboundp 'display-graphic-p
)
80 '("dimple1" "scales" "dot" "cross_weave" "boxes" "dimple3"))
81 "If pixmaps are allowed, display these background pixmaps.
82 Useful if new Emacs is used on B&W display.")
84 (defcustom chart-face-use-pixmaps nil
85 "*Non-nil to use fancy pixmaps in the background of chart face colors."
89 (defvar chart-face-list
90 (if (if (fboundp 'display-color-p
)
93 (let ((cl chart-face-color-list
)
94 (pl chart-face-pixmap-list
)
99 (intern (concat "chart-" (car cl
) "-" (car pl
)))))
100 (set-face-background nf
(if (condition-case nil
101 (> (x-display-color-cells) 4)
105 (set-face-foreground nf
"black")
106 (if (and chart-face-use-pixmaps
108 (fboundp 'set-face-background-pixmap
))
110 (set-face-background-pixmap nf
(car pl
))
111 (error (message "Cannot set background pixmap %s" (car pl
)))))
116 "Faces used to colorize charts.
117 List is limited currently, which is ok since you really can't display
118 too much in text characters anyways.")
120 (define-derived-mode chart-mode fundamental-mode
"CHART"
121 "Define a mode in Emacs for displaying a chart."
122 (buffer-disable-undo)
123 (set (make-local-variable 'font-lock-global-modes
) nil
)
124 (font-lock-mode -
1) ;Isn't it off already? --Stef
127 (defun chart-new-buffer (obj)
128 "Create a new buffer NAME in which the chart OBJ is displayed.
129 Returns the newly created buffer."
130 (with-current-buffer (get-buffer-create (format "*%s*" (oref obj title
)))
132 (setq chart-local-object obj
)
136 ((title :initarg
:title
137 :initform
"Emacs Chart")
138 (title-face :initarg
:title-face
139 :initform
'bold-italic
)
140 (x-axis :initarg
:x-axis
142 (x-margin :initarg
:x-margin
144 (x-width :initarg
:x-width
146 (y-axis :initarg
:y-axis
148 (y-margin :initarg
:y-margin
150 (y-width :initarg
:y-width
152 (key-label :initarg
:key-label
154 (sequences :initarg
:sequences
157 "Superclass for all charts to be displayed in an Emacs buffer.")
159 (defmethod initialize-instance :AFTER
((obj chart
) &rest fields
)
160 "Initialize the chart OBJ being created with FIELDS.
161 Make sure the width/height is correct."
162 (oset obj x-width
(- (window-width) 10))
163 (oset obj y-width
(- (window-height) 12)))
165 (defclass chart-axis
()
166 ((name :initarg
:name
167 :initform
"Generic Axis")
168 (loweredge :initarg
:loweredge
170 (name-face :initarg
:name-face
172 (labels-face :initarg
:lables-face
174 (chart :initarg
:chart
177 "Superclass used for display of an axis.")
179 (defclass chart-axis-range
(chart-axis)
180 ((bounds :initarg
:bounds
181 :initform
'(0.0 .
50.0))
183 "Class used to display an axis defined by a range of values.")
185 (defclass chart-axis-names
(chart-axis)
186 ((items :initarg
:items
189 "Class used to display an axis which represents different named items.")
191 (defclass chart-sequece
()
192 ((data :initarg
:data
197 "Class used for all data in different charts.")
199 (defclass chart-bar
(chart)
200 ((direction :initarg
:direction
202 "Subclass for bar charts (vertical or horizontal).")
204 (defmethod chart-draw ((c chart
) &optional buff
)
205 "Start drawing a chart object C in optional BUFF.
206 Erases current contents of buffer."
208 (if buff
(set-buffer buff
))
210 (insert (make-string 100 ?
\n))
211 ;; Start by displaying the axis
216 (message "Rendering chart...")
221 (message "Rendering chart...done")
224 (defmethod chart-draw-title ((c chart
))
225 "Draw a title upon the chart.
226 Argument C is the chart object."
227 (chart-display-label (oref c title
) 'horizontal
0 0 (window-width)
228 (oref c title-face
)))
230 (defmethod chart-size-in-dir ((c chart
) dir
)
231 "Return the physical size of chart C in direction DIR."
232 (if (eq dir
'vertical
)
236 (defmethod chart-draw-axis ((c chart
))
237 "Draw axis into the current buffer defined by chart C."
238 (let ((ymarg (oref c y-margin
))
239 (xmarg (oref c x-margin
))
240 (ylen (oref c y-width
))
241 (xlen (oref c x-width
)))
242 (chart-axis-draw (oref c y-axis
) 'vertical ymarg
243 (if (oref (oref c y-axis
) loweredge
) nil xlen
)
244 xmarg
(+ xmarg ylen
))
245 (chart-axis-draw (oref c x-axis
) 'horizontal xmarg
246 (if (oref (oref c x-axis
) loweredge
) nil ylen
)
247 ymarg
(+ ymarg xlen
)))
250 (defmethod chart-axis-draw ((a chart-axis
) &optional dir margin zone start end
)
251 "Draw some axis for A in direction DIR with MARGIN in boundary.
252 ZONE is a zone specification.
253 START and END represent the boundary."
254 (chart-draw-line dir
(+ margin
(if zone zone
0)) start end
)
255 (chart-display-label (oref a name
) dir
(if zone
(+ zone margin
3)
256 (if (eq dir
'horizontal
)
258 start end
(oref a name-face
)))
260 (defmethod chart-translate-xpos ((c chart
) x
)
261 "Translate in chart C the coordinate X into a screen column."
262 (let ((range (oref (oref c x-axis
) bounds
)))
264 (round (* (float (- x
(car range
)))
265 (/ (float (oref c x-width
))
266 (float (- (cdr range
) (car range
))))))))
269 (defmethod chart-translate-ypos ((c chart
) y
)
270 "Translate in chart C the coordinate Y into a screen row."
271 (let ((range (oref (oref c y-axis
) bounds
)))
274 (round (* (float (- y
(car range
)))
275 (/ (float (oref c y-width
))
276 (float (- (cdr range
) (car range
)))))))))
279 (defmethod chart-axis-draw ((a chart-axis-range
) &optional dir margin zone start end
)
280 "Draw axis information based upon a range to be spread along the edge.
281 A is the chart to draw. DIR is the direction.
282 MARGIN, ZONE, START, and END specify restrictions in chart space."
284 ;; We prefer about 5 spaces between each value
285 (let* ((i (car (oref a bounds
)))
286 (e (cdr (oref a bounds
)))
290 ;; want to jump by units of 5 spaces or so
291 (j (/ rng
(/ (chart-size-in-dir (oref a chart
) dir
) 4)))
293 (if (= j
0) (setq j
1))
297 (format "%dM" (/ i
1000000)))
299 (format "%dK" (/ i
1000)))
302 (if (eq dir
'vertical
)
303 (let ((x (+ (+ margin z
) (if (oref a loweredge
)
305 (if (< x
1) (setq x
1))
306 (chart-goto-xy x
(chart-translate-ypos (oref a chart
) i
)))
307 (chart-goto-xy (chart-translate-xpos (oref a chart
) i
)
308 (+ margin z
(if (oref a loweredge
) -
1 1))))
311 (chart-zap-chars (length s
))
312 (put-text-property p1
(point) 'face
(oref a labels-face
))
316 (defmethod chart-translate-namezone ((c chart
) n
)
317 "Return a dot-pair representing a positional range for a name.
318 The name in chart C of the Nth name resides.
319 Automatically compensates for direction."
320 (let* ((dir (oref c direction
))
321 (w (if (eq dir
'vertical
) (oref c x-width
) (oref c y-width
)))
322 (m (if (eq dir
'vertical
) (oref c y-margin
) (oref c x-margin
)))
324 (oref (if (eq dir
'vertical
) (oref c x-axis
) (oref c y-axis
))
326 (lpn (/ (+ 1.0 (float w
)) (float ns
)))
328 (cons (+ m
(round (* lpn
(float n
))))
329 (+ m -
1 (round (* lpn
(+ 1.0 (float n
))))))
332 (defmethod chart-axis-draw ((a chart-axis-names
) &optional dir margin zone start end
)
333 "Draw axis information based upon A range to be spread along the edge.
334 Optional argument DIR is the direction of the chart.
335 Optional arguments MARGIN, ZONE, START and END specify boundaries of the drawing."
337 ;; We prefer about 5 spaces between each value
346 (setq odd
(= (%
(length s
) 2) 1))
347 (setq r
(chart-translate-namezone (oref a chart
) i
))
348 (if (eq dir
'vertical
)
349 (setq p
(/ (+ (car r
) (cdr r
)) 2))
350 (setq p
(- (+ (car r
) (/ (- (cdr r
) (car r
)) 2))
351 (/ (length (car s
)) 2))))
352 (if (eq dir
'vertical
)
353 (let ((x (+ (+ margin z
) (if (oref a loweredge
)
356 (if (< x
1) (setq x
1))
357 (if (> (length (car s
)) (1- margin
))
358 (setq x
(+ x margin
)))
360 (chart-goto-xy p
(+ (+ margin z
) (if (oref a loweredge
)
365 (chart-zap-chars (length (car s
)))
366 (put-text-property p1
(point) 'face
(oref a labels-face
))
371 (defmethod chart-draw-data ((c chart-bar
))
372 "Display the data available in a bar chart C."
373 (let* ((data (oref c sequences
))
374 (dir (oref c direction
))
375 (odir (if (eq dir
'vertical
) 'horizontal
'vertical
))
378 (if (stringp (car (oref (car data
) data
)))
379 ;; skip string lists...
381 ;; display number lists...
383 (seq (oref (car data
) data
)))
385 (let* ((rng (chart-translate-namezone c i
))
386 (dp (if (eq dir
'vertical
)
387 (chart-translate-ypos c
(car seq
))
388 (chart-translate-xpos c
(car seq
))))
389 (zp (if (eq dir
'vertical
)
390 (chart-translate-ypos c
0)
391 (chart-translate-xpos c
0)))
392 (fc (if chart-face-list
393 (nth (% i
(length chart-face-list
)) chart-face-list
)
398 (chart-draw-line dir
(car rng
) dp zp
)
399 (chart-draw-line dir
(cdr rng
) dp zp
))
400 (chart-draw-line dir
(car rng
) zp
(1+ dp
))
401 (chart-draw-line dir
(cdr rng
) zp
(1+ dp
)))
402 (if (= (car rng
) (cdr rng
)) nil
403 (chart-draw-line odir dp
(1+ (car rng
)) (cdr rng
))
404 (chart-draw-line odir zp
(car rng
) (1+ (cdr rng
))))
406 (chart-deface-rectangle dir rng
(cons dp zp
) fc
)
407 (chart-deface-rectangle dir rng
(cons zp dp
) fc
))
409 ;; find the bounds, and chart it!
410 ;; for now, only do one!
413 (setq data
(cdr data
))))
416 (defmethod chart-add-sequence ((c chart
) &optional seq axis-label
)
417 "Add to chart object C the sequence object SEQ.
418 If AXIS-LABEL, then the axis stored in C is updated with the bounds of SEQ,
419 or is created with the bounds of SEQ."
421 (let ((axis (eieio-oref c axis-label
)))
422 (if (stringp (car (oref seq data
)))
423 (let ((labels (oref seq data
)))
425 (setq axis
(make-instance chart-axis-names
426 :name
(oref seq name
)
429 (oset axis items labels
)))
430 (let ((range (cons 0 1))
433 (setq axis
(make-instance chart-axis-range
434 :name
(oref seq name
)
437 (if (< (car l
) (car range
)) (setcar range
(car l
)))
438 (if (> (car l
) (cdr range
)) (setcdr range
(car l
)))
440 (oset axis bounds range
)))
441 (if (eq axis-label
'x-axis
) (oset axis loweredge nil
))
442 (eieio-oset c axis-label axis
)
444 (oset c sequences
(append (oref c sequences
) (list seq
))))
446 ;;; Charting optimizers
448 (defmethod chart-trim ((c chart
) max
)
449 "Trim all sequences in chart C to be at most MAX elements long."
450 (let ((s (oref c sequences
)))
452 (let ((sl (oref (car s
) data
)))
453 (if (> (length sl
) max
)
454 (setcdr (nthcdr (1- max
) sl
) nil
)))
458 (defmethod chart-sort ((c chart
) pred
)
459 "Sort the data in chart C using predicate PRED.
460 See `chart-sort-matchlist' for more details."
461 (let* ((sl (oref c sequences
))
465 (if (stringp (car (oref s1 data
)))
467 (chart-sort-matchlist s1 s2 pred
)
468 (setq s
(oref s1 data
)))
469 (if (stringp (car (oref s2 data
)))
471 (chart-sort-matchlist s2 s1 pred
)
472 (setq s
(oref s2 data
)))
473 (error "Sorting of chart %s not supported" (object-name c
))))
474 (if (eq (oref c direction
) 'horizontal
)
475 (oset (oref c y-axis
) items s
)
476 (oset (oref c x-axis
) items s
)
480 (defun chart-sort-matchlist (namelst numlst pred
)
481 "Sort NAMELST and NUMLST (both sequence objects) based on predicate PRED.
482 PRED should be the equivalent of '<, except it must expect two
483 cons cells of the form (NAME . NUM). See `sort' for more details."
484 ;; 1 - create 1 list of cons cells
486 (alst (oref namelst data
))
487 (ulst (oref numlst data
)))
489 ;; this is reversed, but were are sorting anyway
490 (setq newlist
(cons (cons (car alst
) (car ulst
)) newlist
))
491 (setq alst
(cdr alst
)
493 ;; 2 - Run sort routine on it
494 (setq newlist
(sort newlist pred
)
497 ;; 3 - Separate the lists
499 (setq alst
(cons (car (car newlist
)) alst
)
500 ulst
(cons (cdr (car newlist
)) ulst
))
501 (setq newlist
(cdr newlist
)))
502 ;; 4 - Store them back
503 (oset namelst data
(reverse alst
))
504 (oset numlst data
(reverse ulst
))))
508 (defun chart-goto-xy (x y
)
509 "Move cursor to position X Y in buffer, and add spaces and CRs if needed."
510 (let ((indent-tabs-mode nil
)
511 (num (progn (goto-char (point-min)) (forward-line y
))))
512 (if (and (= 0 num
) (/= 0 (current-column))) (newline 1))
513 (if (eobp) (newline num
))
514 (if (< x
0) (setq x
0))
515 (if (< y
0) (setq y
0))
516 ;; Now, a quicky column moveto/forceto method.
517 (or (= (move-to-column x
) x
)
520 (remove-text-properties p
(point) '(face))))))
522 (defun chart-zap-chars (n)
523 "Zap up to N chars without deleting EOLs."
525 (if (< n
(- (point-at-eol) (point)))
527 (delete-region (point) (point-at-eol)))))
529 (defun chart-display-label (label dir zone start end
&optional face
)
530 "Display LABEL in direction DIR in column/row ZONE between START and END.
531 Optional argument FACE is the property we wish to place on this text."
532 (if (eq dir
'horizontal
)
534 (chart-goto-xy (+ start
(- (/ (- end start
) 2) (/ (length label
) 2)))
538 (chart-zap-chars (length label
))
539 (put-text-property p1
(point) 'face face
)
542 (stz (+ start
(- (/ (- end start
) 2) (/ (length label
) 2)))))
543 (while (< i
(length label
))
544 (chart-goto-xy zone
(+ stz i
))
545 (insert (aref label i
))
547 (put-text-property (1- (point)) (point) 'face face
)
550 (defun chart-draw-line (dir zone start end
)
551 "Draw a line using line-drawing characters in direction DIR.
552 Use column or row ZONE between START and END."
554 (make-string (- end start
) (if (eq dir
'vertical
) ?| ?\-
))
557 (defun chart-deface-rectangle (dir r1 r2 face
)
558 "Colorize a rectangle in direction DIR across range R1 by range R2.
559 R1 and R2 are dotted pairs. Colorize it with FACE."
560 (let* ((range1 (if (eq dir
'vertical
) r1 r2
))
561 (range2 (if (eq dir
'vertical
) r2 r1
))
563 (while (<= y
(cdr range2
))
564 (chart-goto-xy (car range1
) y
)
565 (put-text-property (point) (+ (point) (1+ (- (cdr range1
) (car range1
))))
569 ;;; Helpful `I don't want to learn eieio just now' washover functions
571 (defun chart-bar-quickie (dir title namelst nametitle numlst numtitle
572 &optional max sort-pred
)
573 "Wash over the complex EIEIO stuff and create a nice bar chart.
574 Create it going in direction DIR ['horizontal 'vertical] with TITLE
575 using a name sequence NAMELST labeled NAMETITLE with values NUMLST
578 Set the chart's max element display to MAX, and sort lists with
579 SORT-PRED if desired."
580 (let ((nc (make-instance chart-bar
582 :key-label
"8-m" ; This is a text key pic
585 (iv (eq dir
'vertical
)))
586 (chart-add-sequence nc
587 (make-instance chart-sequece
590 (if iv
'x-axis
'y-axis
))
591 (chart-add-sequence nc
592 (make-instance chart-sequece
595 (if iv
'y-axis
'x-axis
))
596 (if sort-pred
(chart-sort nc sort-pred
))
597 (if (integerp max
) (chart-trim nc max
))
598 (switch-to-buffer (chart-new-buffer nc
))
603 (defun chart-test-it-all ()
604 "Test out various charting features."
606 (chart-bar-quickie 'vertical
"Test Bar Chart"
607 '( "U1" "ME2" "C3" "B4" "QT" "EZ") "Items"
608 '( 5 -
10 23 20 30 -
3) "Values")
611 ;;; Sample utility function
613 (defun chart-file-count (dir)
614 "Draw a chart displaying the number of different file extensions in DIR."
615 (interactive "DDirectory: ")
616 (if (not (string-match "/$" dir
))
617 (setq dir
(concat dir
"/")))
618 (message "Collecting statistics...")
619 (let ((flst (directory-files dir nil nil t
))
620 (extlst (list "<dir>"))
623 (let* ((j (string-match "[^\\.]\\(\\.[a-zA-Z]+\\|~\\|#\\)$" (car flst
)))
624 (s (if (file-accessible-directory-p (concat dir
(car flst
)))
627 (substring (car flst
) (match-beginning 1) (match-end 1))
629 (m (member s extlst
)))
632 (let ((cell (nthcdr (- (length extlst
) (length m
)) cntlst
)))
633 (setcar cell
(1+ (car cell
))))
634 (setq extlst
(cons s extlst
)
635 cntlst
(cons 1 cntlst
)))))
636 (setq flst
(cdr flst
)))
637 ;; Lets create the chart!
638 (chart-bar-quickie 'vertical
"Files Extension Distribution"
639 extlst
"File Extensions"
640 cntlst
"# of occurrences"
642 (lambda (a b
) (> (cdr a
) (cdr b
))))
645 (defun chart-space-usage (d)
646 "Display a top usage chart for directory D."
647 (interactive "DDirectory: ")
648 (message "Collecting statistics...")
651 (b (get-buffer-create " *du-tmp*")))
654 (insert "cd " d
";du -sk * \n")
655 (message "Running `cd %s;du -sk *'..." d
)
656 (call-process-region (point-min) (point-max) shell-file-name t
657 (current-buffer) nil
)
658 (goto-char (point-min))
659 (message "Scanning output ...")
660 (while (re-search-forward "^\\([0-9]+\\)[ \t]+\\([^ \n]+\\)$" nil t
)
661 (let* ((nam (buffer-substring (match-beginning 2) (match-end 2)))
662 (num (buffer-substring (match-beginning 1) (match-end 1))))
663 (setq nmlst
(cons nam nmlst
)
664 ;; * 1000 to put it into bytes
665 cntlst
(cons (* (string-to-number num
) 1000) cntlst
))))
667 (error "No files found!"))
668 (chart-bar-quickie 'vertical
(format "Largest files in %s" d
)
672 (lambda (a b
) (> (cdr a
) (cdr b
))))
675 (defun chart-emacs-storage ()
676 "Chart the current storage requirements of Emacs."
678 (let* ((data (garbage-collect))
679 (names '("strings/2" "vectors"
682 "markers" "free mark"
683 ;; "floats" "free flt"
685 (nums (list (/ (nth 3 data
) 2)
687 (car (car data
)) ; conses
689 (car (nth 1 data
)) ; syms
691 (car (nth 2 data
)) ; markers
693 ;(car (nth 5 data)) ; floats are Emacs only
696 ;; Lets create the chart!
697 (chart-bar-quickie 'vertical
"Emacs Runtime Storage Usage"
698 names
"Storage Items"
701 (defun chart-emacs-lists ()
702 "Chart out the size of various important lists."
704 (let* ((names '("buffers" "frames" "processes" "faces"))
705 (nums (list (length (buffer-list))
706 (length (frame-list))
707 (length (process-list))
710 (if (fboundp 'x-display-list
)
711 (setq names
(append names
'("x-displays"))
712 nums
(append nums
(list (length (x-display-list))))))
713 ;; Lets create the chart!
714 (chart-bar-quickie 'vertical
"Emacs List Size Chart"
715 names
"Various Lists"
718 (defun chart-rmail-from ()
719 "If we are in an rmail summary buffer, then chart out the froms."
721 (if (not (eq major-mode
'rmail-summary-mode
))
722 (error "You must invoke chart-rmail-from in an rmail summary buffer"))
726 (goto-char (point-min))
727 (while (re-search-forward "\\-[A-Z][a-z][a-z] +\\(\\w+\\)@\\w+" nil t
)
728 (let* ((nam (buffer-substring (match-beginning 1) (match-end 1)))
729 (m (member nam nmlst
)))
730 (message "Scanned username %s" nam
)
732 (let ((cell (nthcdr (- (length nmlst
) (length m
)) cntlst
)))
733 (setcar cell
(1+ (car cell
))))
734 (setq nmlst
(cons nam nmlst
)
735 cntlst
(cons 1 cntlst
))))))
736 (chart-bar-quickie 'vertical
"Username Occurrence in RMAIL box"
738 cntlst
"# of occurrences"
740 (lambda (a b
) (> (cdr a
) (cdr b
))))
746 ;;; chart.el ends here