1 ;;; chart.el --- Draw charts (bar charts, etc)
3 ;; Copyright (C) 1996, 1998, 1999, 2001, 2004, 2005, 2007, 2008, 2009,
4 ;; 2010 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-map
(make-sparse-keymap) "Keymap used in chart mode.")
67 (defvar chart-local-object nil
68 "Local variable containing the locally displayed chart object.")
69 (make-variable-buffer-local 'chart-local-object
)
71 (defvar chart-face-list nil
72 "Faces used to colorize charts.
73 List is limited currently, which is ok since you really can't display
74 too much in text characters anyways.")
76 (defvar chart-face-color-list
'("red" "green" "blue"
77 "cyan" "yellow" "purple")
78 "Colors to use when generating `chart-face-list'.
79 Colors will be the background color.")
81 (defvar chart-face-pixmap-list
82 (if (and (fboundp 'display-graphic-p
)
84 '("dimple1" "scales" "dot" "cross_weave" "boxes" "dimple3"))
85 "If pixmaps are allowed, display these background pixmaps.
86 Useful if new Emacs is used on B&W display.")
88 (defcustom chart-face-use-pixmaps nil
89 "*Non-nil to use fancy pixmaps in the background of chart face colors."
93 (if (and (if (fboundp 'display-color-p
)
96 (not chart-face-list
))
97 (let ((cl chart-face-color-list
)
98 (pl chart-face-pixmap-list
)
101 (setq nf
(make-face (intern (concat "chart-" (car cl
) "-" (car pl
)))))
102 (if (condition-case nil
103 (> (x-display-color-cells) 4)
105 (set-face-background nf
(car cl
))
106 (set-face-background nf
"white"))
107 (set-face-foreground nf
"black")
108 (if (and chart-face-use-pixmaps
110 (fboundp 'set-face-background-pixmap
))
112 (set-face-background-pixmap nf
(car pl
))
113 (error (message "Cannot set background pixmap %s" (car pl
)))))
114 (setq chart-face-list
(cons nf chart-face-list
))
119 "Define a mode in Emacs for displaying a chart."
120 (kill-all-local-variables)
121 (use-local-map chart-map
)
122 (setq major-mode
'chart-mode
124 (buffer-disable-undo)
125 (set (make-local-variable 'font-lock-global-modes
) nil
)
127 (run-hooks 'chart-mode-hook
)
130 (defun chart-new-buffer (obj)
131 "Create a new buffer NAME in which the chart OBJ is displayed.
132 Returns the newly created buffer."
133 (with-current-buffer (get-buffer-create (format "*%s*" (oref obj title
)))
135 (setq chart-local-object obj
)
139 ((title :initarg
:title
140 :initform
"Emacs Chart")
141 (title-face :initarg
:title-face
142 :initform
'bold-italic
)
143 (x-axis :initarg
:x-axis
145 (x-margin :initarg
:x-margin
147 (x-width :initarg
:x-width
149 (y-axis :initarg
:y-axis
151 (y-margin :initarg
:y-margin
153 (y-width :initarg
:y-width
155 (key-label :initarg
:key-label
157 (sequences :initarg
:sequences
160 "Superclass for all charts to be displayed in an Emacs buffer.")
162 (defmethod initialize-instance :AFTER
((obj chart
) &rest fields
)
163 "Initialize the chart OBJ being created with FIELDS.
164 Make sure the width/height is correct."
165 (oset obj x-width
(- (window-width) 10))
166 (oset obj y-width
(- (window-height) 12)))
168 (defclass chart-axis
()
169 ((name :initarg
:name
170 :initform
"Generic Axis")
171 (loweredge :initarg
:loweredge
173 (name-face :initarg
:name-face
175 (labels-face :initarg
:lables-face
177 (chart :initarg
:chart
180 "Superclass used for display of an axis.")
182 (defclass chart-axis-range
(chart-axis)
183 ((bounds :initarg
:bounds
184 :initform
'(0.0 .
50.0))
186 "Class used to display an axis defined by a range of values.")
188 (defclass chart-axis-names
(chart-axis)
189 ((items :initarg
:items
192 "Class used to display an axis which represents different named items.")
194 (defclass chart-sequece
()
195 ((data :initarg
:data
200 "Class used for all data in different charts.")
202 (defclass chart-bar
(chart)
203 ((direction :initarg
:direction
205 "Subclass for bar charts (vertical or horizontal).")
207 (defmethod chart-draw ((c chart
) &optional buff
)
208 "Start drawing a chart object C in optional BUFF.
209 Erases current contents of buffer."
211 (if buff
(set-buffer buff
))
213 (insert (make-string 100 ?
\n))
214 ;; Start by displaying the axis
219 (message "Rendering chart...")
224 (message "Rendering chart...done")
227 (defmethod chart-draw-title ((c chart
))
228 "Draw a title upon the chart.
229 Argument C is the chart object."
230 (chart-display-label (oref c title
) 'horizontal
0 0 (window-width)
231 (oref c title-face
)))
233 (defmethod chart-size-in-dir ((c chart
) dir
)
234 "Return the physical size of chart C in direction DIR."
235 (if (eq dir
'vertical
)
239 (defmethod chart-draw-axis ((c chart
))
240 "Draw axis into the current buffer defined by chart C."
241 (let ((ymarg (oref c y-margin
))
242 (xmarg (oref c x-margin
))
243 (ylen (oref c y-width
))
244 (xlen (oref c x-width
)))
245 (chart-axis-draw (oref c y-axis
) 'vertical ymarg
246 (if (oref (oref c y-axis
) loweredge
) nil xlen
)
247 xmarg
(+ xmarg ylen
))
248 (chart-axis-draw (oref c x-axis
) 'horizontal xmarg
249 (if (oref (oref c x-axis
) loweredge
) nil ylen
)
250 ymarg
(+ ymarg xlen
)))
253 (defmethod chart-axis-draw ((a chart-axis
) &optional dir margin zone start end
)
254 "Draw some axis for A in direction DIR with MARGIN in boundary.
255 ZONE is a zone specification.
256 START and END represent the boundary."
257 (chart-draw-line dir
(+ margin
(if zone zone
0)) start end
)
258 (chart-display-label (oref a name
) dir
(if zone
(+ zone margin
3)
259 (if (eq dir
'horizontal
)
261 start end
(oref a name-face
)))
263 (defmethod chart-translate-xpos ((c chart
) x
)
264 "Translate in chart C the coordinate X into a screen column."
265 (let ((range (oref (oref c x-axis
) bounds
)))
267 (round (* (float (- x
(car range
)))
268 (/ (float (oref c x-width
))
269 (float (- (cdr range
) (car range
))))))))
272 (defmethod chart-translate-ypos ((c chart
) y
)
273 "Translate in chart C the coordinate Y into a screen row."
274 (let ((range (oref (oref c y-axis
) bounds
)))
277 (round (* (float (- y
(car range
)))
278 (/ (float (oref c y-width
))
279 (float (- (cdr range
) (car range
)))))))))
282 (defmethod chart-axis-draw ((a chart-axis-range
) &optional dir margin zone start end
)
283 "Draw axis information based upon a range to be spread along the edge.
284 A is the chart to draw. DIR is the direction.
285 MARGIN, ZONE, START, and END specify restrictions in chart space."
287 ;; We prefer about 5 spaces between each value
288 (let* ((i (car (oref a bounds
)))
289 (e (cdr (oref a bounds
)))
293 ;; want to jump by units of 5 spaces or so
294 (j (/ rng
(/ (chart-size-in-dir (oref a chart
) dir
) 4)))
296 (if (= j
0) (setq j
1))
300 (format "%dM" (/ i
1000000)))
302 (format "%dK" (/ i
1000)))
305 (if (eq dir
'vertical
)
306 (let ((x (+ (+ margin z
) (if (oref a loweredge
)
308 (if (< x
1) (setq x
1))
309 (chart-goto-xy x
(chart-translate-ypos (oref a chart
) i
)))
310 (chart-goto-xy (chart-translate-xpos (oref a chart
) i
)
311 (+ margin z
(if (oref a loweredge
) -
1 1))))
314 (chart-zap-chars (length s
))
315 (put-text-property p1
(point) 'face
(oref a labels-face
))
319 (defmethod chart-translate-namezone ((c chart
) n
)
320 "Return a dot-pair representing a positional range for a name.
321 The name in chart C of the Nth name resides.
322 Automatically compensates for direction."
323 (let* ((dir (oref c direction
))
324 (w (if (eq dir
'vertical
) (oref c x-width
) (oref c y-width
)))
325 (m (if (eq dir
'vertical
) (oref c y-margin
) (oref c x-margin
)))
327 (oref (if (eq dir
'vertical
) (oref c x-axis
) (oref c y-axis
))
329 (lpn (/ (+ 1.0 (float w
)) (float ns
)))
331 (cons (+ m
(round (* lpn
(float n
))))
332 (+ m -
1 (round (* lpn
(+ 1.0 (float n
))))))
335 (defmethod chart-axis-draw ((a chart-axis-names
) &optional dir margin zone start end
)
336 "Draw axis information based upon A range to be spread along the edge.
337 Optional argument DIR is the direction of the chart.
338 Optional arguments MARGIN, ZONE, START and END specify boundaries of the drawing."
340 ;; We prefer about 5 spaces between each value
349 (setq odd
(= (%
(length s
) 2) 1))
350 (setq r
(chart-translate-namezone (oref a chart
) i
))
351 (if (eq dir
'vertical
)
352 (setq p
(/ (+ (car r
) (cdr r
)) 2))
353 (setq p
(- (+ (car r
) (/ (- (cdr r
) (car r
)) 2))
354 (/ (length (car s
)) 2))))
355 (if (eq dir
'vertical
)
356 (let ((x (+ (+ margin z
) (if (oref a loweredge
)
359 (if (< x
1) (setq x
1))
360 (if (> (length (car s
)) (1- margin
))
361 (setq x
(+ x margin
)))
363 (chart-goto-xy p
(+ (+ margin z
) (if (oref a loweredge
)
368 (chart-zap-chars (length (car s
)))
369 (put-text-property p1
(point) 'face
(oref a labels-face
))
374 (defmethod chart-draw-data ((c chart-bar
))
375 "Display the data available in a bar chart C."
376 (let* ((data (oref c sequences
))
377 (dir (oref c direction
))
378 (odir (if (eq dir
'vertical
) 'horizontal
'vertical
))
381 (if (stringp (car (oref (car data
) data
)))
382 ;; skip string lists...
384 ;; display number lists...
386 (seq (oref (car data
) data
)))
388 (let* ((rng (chart-translate-namezone c i
))
389 (dp (if (eq dir
'vertical
)
390 (chart-translate-ypos c
(car seq
))
391 (chart-translate-xpos c
(car seq
))))
392 (zp (if (eq dir
'vertical
)
393 (chart-translate-ypos c
0)
394 (chart-translate-xpos c
0)))
395 (fc (if chart-face-list
396 (nth (% i
(length chart-face-list
)) chart-face-list
)
401 (chart-draw-line dir
(car rng
) dp zp
)
402 (chart-draw-line dir
(cdr rng
) dp zp
))
403 (chart-draw-line dir
(car rng
) zp
(1+ dp
))
404 (chart-draw-line dir
(cdr rng
) zp
(1+ dp
)))
405 (if (= (car rng
) (cdr rng
)) nil
406 (chart-draw-line odir dp
(1+ (car rng
)) (cdr rng
))
407 (chart-draw-line odir zp
(car rng
) (1+ (cdr rng
))))
409 (chart-deface-rectangle dir rng
(cons dp zp
) fc
)
410 (chart-deface-rectangle dir rng
(cons zp dp
) fc
))
412 ;; find the bounds, and chart it!
413 ;; for now, only do one!
416 (setq data
(cdr data
))))
419 (defmethod chart-add-sequence ((c chart
) &optional seq axis-label
)
420 "Add to chart object C the sequence object SEQ.
421 If AXIS-LABEL, then the axis stored in C is updated with the bounds of SEQ,
422 or is created with the bounds of SEQ."
424 (let ((axis (eieio-oref c axis-label
)))
425 (if (stringp (car (oref seq data
)))
426 (let ((labels (oref seq data
)))
428 (setq axis
(make-instance chart-axis-names
429 :name
(oref seq name
)
432 (oset axis items labels
)))
433 (let ((range (cons 0 1))
436 (setq axis
(make-instance chart-axis-range
437 :name
(oref seq name
)
440 (if (< (car l
) (car range
)) (setcar range
(car l
)))
441 (if (> (car l
) (cdr range
)) (setcdr range
(car l
)))
443 (oset axis bounds range
)))
444 (if (eq axis-label
'x-axis
) (oset axis loweredge nil
))
445 (eieio-oset c axis-label axis
)
447 (oset c sequences
(append (oref c sequences
) (list seq
))))
449 ;;; Charting optimizers
451 (defmethod chart-trim ((c chart
) max
)
452 "Trim all sequences in chart C to be at most MAX elements long."
453 (let ((s (oref c sequences
)))
455 (let ((sl (oref (car s
) data
)))
456 (if (> (length sl
) max
)
457 (setcdr (nthcdr (1- max
) sl
) nil
)))
461 (defmethod chart-sort ((c chart
) pred
)
462 "Sort the data in chart C using predicate PRED.
463 See `chart-sort-matchlist' for more details."
464 (let* ((sl (oref c sequences
))
468 (if (stringp (car (oref s1 data
)))
470 (chart-sort-matchlist s1 s2 pred
)
471 (setq s
(oref s1 data
)))
472 (if (stringp (car (oref s2 data
)))
474 (chart-sort-matchlist s2 s1 pred
)
475 (setq s
(oref s2 data
)))
476 (error "Sorting of chart %s not supported" (object-name c
))))
477 (if (eq (oref c direction
) 'horizontal
)
478 (oset (oref c y-axis
) items s
)
479 (oset (oref c x-axis
) items s
)
483 (defun chart-sort-matchlist (namelst numlst pred
)
484 "Sort NAMELST and NUMLST (both sequence objects) based on predicate PRED.
485 PRED should be the equivalent of '<, except it must expect two
486 cons cells of the form (NAME . NUM). See `sort' for more details."
487 ;; 1 - create 1 list of cons cells
489 (alst (oref namelst data
))
490 (ulst (oref numlst data
)))
492 ;; this is reversed, but were are sorting anyway
493 (setq newlist
(cons (cons (car alst
) (car ulst
)) newlist
))
494 (setq alst
(cdr alst
)
496 ;; 2 - Run sort routine on it
497 (setq newlist
(sort newlist pred
)
500 ;; 3 - Separate the lists
502 (setq alst
(cons (car (car newlist
)) alst
)
503 ulst
(cons (cdr (car newlist
)) ulst
))
504 (setq newlist
(cdr newlist
)))
505 ;; 4 - Store them back
506 (oset namelst data
(reverse alst
))
507 (oset numlst data
(reverse ulst
))))
511 (defun chart-goto-xy (x y
)
512 "Move cursor to position X Y in buffer, and add spaces and CRs if needed."
513 (let ((indent-tabs-mode nil
)
514 (num (progn (goto-char (point-min)) (forward-line y
))))
515 (if (and (= 0 num
) (/= 0 (current-column))) (newline 1))
516 (if (eobp) (newline num
))
517 (if (< x
0) (setq x
0))
518 (if (< y
0) (setq y
0))
519 ;; Now, a quicky column moveto/forceto method.
520 (or (= (move-to-column x
) x
)
523 (remove-text-properties p
(point) '(face))))))
525 (defun chart-zap-chars (n)
526 "Zap up to N chars without deleting EOLs."
528 (if (< n
(- (point-at-eol) (point)))
530 (delete-region (point) (point-at-eol)))))
532 (defun chart-display-label (label dir zone start end
&optional face
)
533 "Display LABEL in direction DIR in column/row ZONE between START and END.
534 Optional argument FACE is the property we wish to place on this text."
535 (if (eq dir
'horizontal
)
537 (chart-goto-xy (+ start
(- (/ (- end start
) 2) (/ (length label
) 2)))
541 (chart-zap-chars (length label
))
542 (put-text-property p1
(point) 'face face
)
545 (stz (+ start
(- (/ (- end start
) 2) (/ (length label
) 2)))))
546 (while (< i
(length label
))
547 (chart-goto-xy zone
(+ stz i
))
548 (insert (aref label i
))
550 (put-text-property (1- (point)) (point) 'face face
)
553 (defun chart-draw-line (dir zone start end
)
554 "Draw a line using line-drawing characters in direction DIR.
555 Use column or row ZONE between START and END."
557 (make-string (- end start
) (if (eq dir
'vertical
) ?| ?\-
))
560 (defun chart-deface-rectangle (dir r1 r2 face
)
561 "Colorize a rectangle in direction DIR across range R1 by range R2.
562 R1 and R2 are dotted pairs. Colorize it with FACE."
563 (let* ((range1 (if (eq dir
'vertical
) r1 r2
))
564 (range2 (if (eq dir
'vertical
) r2 r1
))
566 (while (<= y
(cdr range2
))
567 (chart-goto-xy (car range1
) y
)
568 (put-text-property (point) (+ (point) (1+ (- (cdr range1
) (car range1
))))
572 ;;; Helpful `I don't want to learn eieio just now' washover functions
574 (defun chart-bar-quickie (dir title namelst nametitle numlst numtitle
575 &optional max sort-pred
)
576 "Wash over the complex EIEIO stuff and create a nice bar chart.
577 Create it going in direction DIR ['horizontal 'vertical] with TITLE
578 using a name sequence NAMELST labeled NAMETITLE with values NUMLST
581 Set the chart's max element display to MAX, and sort lists with
582 SORT-PRED if desired."
583 (let ((nc (make-instance chart-bar
585 :key-label
"8-m" ; This is a text key pic
588 (iv (eq dir
'vertical
)))
589 (chart-add-sequence nc
590 (make-instance chart-sequece
593 (if iv
'x-axis
'y-axis
))
594 (chart-add-sequence nc
595 (make-instance chart-sequece
598 (if iv
'y-axis
'x-axis
))
599 (if sort-pred
(chart-sort nc sort-pred
))
600 (if (integerp max
) (chart-trim nc max
))
601 (switch-to-buffer (chart-new-buffer nc
))
606 (defun chart-test-it-all ()
607 "Test out various charting features."
609 (chart-bar-quickie 'vertical
"Test Bar Chart"
610 '( "U1" "ME2" "C3" "B4" "QT" "EZ") "Items"
611 '( 5 -
10 23 20 30 -
3) "Values")
614 ;;; Sample utility function
616 (defun chart-file-count (dir)
617 "Draw a chart displaying the number of different file extensions in DIR."
618 (interactive "DDirectory: ")
619 (if (not (string-match "/$" dir
))
620 (setq dir
(concat dir
"/")))
621 (message "Collecting statistics...")
622 (let ((flst (directory-files dir nil nil t
))
623 (extlst (list "<dir>"))
626 (let* ((j (string-match "[^\\.]\\(\\.[a-zA-Z]+\\|~\\|#\\)$" (car flst
)))
627 (s (if (file-accessible-directory-p (concat dir
(car flst
)))
630 (substring (car flst
) (match-beginning 1) (match-end 1))
632 (m (member s extlst
)))
635 (let ((cell (nthcdr (- (length extlst
) (length m
)) cntlst
)))
636 (setcar cell
(1+ (car cell
))))
637 (setq extlst
(cons s extlst
)
638 cntlst
(cons 1 cntlst
)))))
639 (setq flst
(cdr flst
)))
640 ;; Lets create the chart!
641 (chart-bar-quickie 'vertical
"Files Extension Distribution"
642 extlst
"File Extensions"
643 cntlst
"# of occurrences"
645 '(lambda (a b
) (> (cdr a
) (cdr b
))))
648 (defun chart-space-usage (d)
649 "Display a top usage chart for directory D."
650 (interactive "DDirectory: ")
651 (message "Collecting statistics...")
654 (b (get-buffer-create " *du-tmp*")))
657 (insert "cd " d
";du -sk * \n")
658 (message "Running `cd %s;du -sk *'..." d
)
659 (call-process-region (point-min) (point-max) shell-file-name t
660 (current-buffer) nil
)
661 (goto-char (point-min))
662 (message "Scanning output ...")
663 (while (re-search-forward "^\\([0-9]+\\)[ \t]+\\([^ \n]+\\)$" nil t
)
664 (let* ((nam (buffer-substring (match-beginning 2) (match-end 2)))
665 (num (buffer-substring (match-beginning 1) (match-end 1))))
666 (setq nmlst
(cons nam nmlst
)
667 ;; * 1000 to put it into bytes
668 cntlst
(cons (* (string-to-number num
) 1000) cntlst
))))
670 (error "No files found!"))
671 (chart-bar-quickie 'vertical
(format "Largest files in %s" d
)
675 '(lambda (a b
) (> (cdr a
) (cdr b
))))
678 (defun chart-emacs-storage ()
679 "Chart the current storage requirements of Emacs."
681 (let* ((data (garbage-collect))
682 (names '("strings/2" "vectors"
685 "markers" "free mark"
686 ;; "floats" "free flt"
688 (nums (list (/ (nth 3 data
) 2)
690 (car (car data
)) ; conses
692 (car (nth 1 data
)) ; syms
694 (car (nth 2 data
)) ; markers
696 ;(car (nth 5 data)) ; floats are Emacs only
699 ;; Lets create the chart!
700 (chart-bar-quickie 'vertical
"Emacs Runtime Storage Usage"
701 names
"Storage Items"
704 (defun chart-emacs-lists ()
705 "Chart out the size of various important lists."
707 (let* ((names '("buffers" "frames" "processes" "faces"))
708 (nums (list (length (buffer-list))
709 (length (frame-list))
710 (length (process-list))
713 (if (fboundp 'x-display-list
)
714 (setq names
(append names
'("x-displays"))
715 nums
(append nums
(list (length (x-display-list))))))
716 ;; Lets create the chart!
717 (chart-bar-quickie 'vertical
"Emacs List Size Chart"
718 names
"Various Lists"
721 (defun chart-rmail-from ()
722 "If we are in an rmail summary buffer, then chart out the froms."
724 (if (not (eq major-mode
'rmail-summary-mode
))
725 (error "You must invoke chart-rmail-from in an rmail summary buffer"))
729 (goto-char (point-min))
730 (while (re-search-forward "\\-[A-Z][a-z][a-z] +\\(\\w+\\)@\\w+" nil t
)
731 (let* ((nam (buffer-substring (match-beginning 1) (match-end 1)))
732 (m (member nam nmlst
)))
733 (message "Scanned username %s" nam
)
735 (let ((cell (nthcdr (- (length nmlst
) (length m
)) cntlst
)))
736 (setcar cell
(1+ (car cell
))))
737 (setq nmlst
(cons nam nmlst
)
738 cntlst
(cons 1 cntlst
))))))
739 (chart-bar-quickie 'vertical
"Username Occurrence in RMAIL box"
741 cntlst
"# of occurrences"
743 '(lambda (a b
) (> (cdr a
) (cdr b
))))
749 ;;; chart.el ends here