-;;; chart.el --- Draw charts (bar charts, etc)
+;;; chart.el --- Draw charts (bar charts, etc) -*- lexical-binding: t -*-
-;; Copyright (C) 1996, 1998-1999, 2001, 2004-2005, 2007-2011
+;; Copyright (C) 1996, 1998-1999, 2001, 2004-2005, 2007-2012
;; Free Software Foundation, Inc.
;; Author: Eric M. Ludlam <zappo@gnu.org>
(require 'eieio)
;;; Code:
-(defvar chart-mode-map (make-sparse-keymap) "Keymap used in chart mode.")
(define-obsolete-variable-alias 'chart-map 'chart-mode-map "24.1")
+(defvar chart-mode-map (make-sparse-keymap) "Keymap used in chart mode.")
(defvar chart-local-object nil
"Local variable containing the locally displayed chart object.")
Useful if new Emacs is used on B&W display.")
(defcustom chart-face-use-pixmaps nil
- "*Non-nil to use fancy pixmaps in the background of chart face colors."
+ "Non-nil to use fancy pixmaps in the background of chart face colors."
:group 'eieio
:type 'boolean)
)
"Superclass for all charts to be displayed in an Emacs buffer.")
-(defmethod initialize-instance :AFTER ((obj chart) &rest fields)
+(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))
:initform t)
(name-face :initarg :name-face
:initform 'bold)
- (labels-face :initarg :lables-face
+ (labels-face :initarg :labels-face
:initform 'italic)
(chart :initarg :chart
:initform nil)
(float (- (cdr range) (car range)))))))))
)
-(defmethod chart-axis-draw ((a chart-axis-range) &optional dir margin zone start end)
+(defmethod chart-axis-draw ((a chart-axis-range) &optional dir margin zone _start _end)
"Draw axis information based upon a range to be spread along the edge.
A is the chart to draw. DIR is the direction.
MARGIN, ZONE, START, and END specify restrictions in chart space."
(+ m -1 (round (* lpn (+ 1.0 (float n))))))
))
-(defmethod chart-axis-draw ((a chart-axis-names) &optional dir margin zone start end)
+(defmethod chart-axis-draw ((a chart-axis-names) &optional dir margin zone _start _end)
"Draw axis information based upon A range to be spread along the edge.
Optional argument DIR is the direction of the chart.
Optional arguments MARGIN, ZONE, START and END specify boundaries of the drawing."
(setq extlst (cons s extlst)
cntlst (cons 1 cntlst)))))
(setq flst (cdr flst)))
- ;; Lets create the chart!
+ ;; Let's create the chart!
(chart-bar-quickie 'vertical "Files Extension Distribution"
extlst "File Extensions"
cntlst "# of occurrences"
(defun chart-emacs-storage ()
"Chart the current storage requirements of Emacs."
(interactive)
- (let* ((data (garbage-collect))
- (names '("strings/2" "vectors"
- "conses" "free cons"
- "syms" "free syms"
- "markers" "free mark"
- ;; "floats" "free flt"
- ))
- (nums (list (/ (nth 3 data) 2)
- (nth 4 data)
- (car (car data)) ; conses
- (cdr (car data))
- (car (nth 1 data)) ; syms
- (cdr (nth 1 data))
- (car (nth 2 data)) ; markers
- (cdr (nth 2 data))
- ;(car (nth 5 data)) ; floats are Emacs only
- ;(cdr (nth 5 data))
- )))
- ;; Lets create the chart!
+ (let* ((data (garbage-collect)))
+ ;; Let's create the chart!
(chart-bar-quickie 'vertical "Emacs Runtime Storage Usage"
- names "Storage Items"
- nums "Objects")))
+ (mapcar (lambda (x) (symbol-name (car x))) data)
+ "Storage Items"
+ (mapcar (lambda (x) (* (nth 1 x) (nth 2 x)))
+ data)
+ "Bytes")))
(defun chart-emacs-lists ()
"Chart out the size of various important lists."
(if (fboundp 'x-display-list)
(setq names (append names '("x-displays"))
nums (append nums (list (length (x-display-list))))))
- ;; Lets create the chart!
+ ;; Let's create the chart!
(chart-bar-quickie 'vertical "Emacs List Size Chart"
names "Various Lists"
nums "Objects")))