diff options
author | David Arroyo Menéndez <davidam@gmail.com> | 2014-10-15 14:58:13 +0200 |
---|---|---|
committer | David Arroyo Menéndez <davidam@gmail.com> | 2014-10-15 14:58:13 +0200 |
commit | 03c0ab007954be7ecd22dba11575c66795b9f905 (patch) | |
tree | 524d2f403f137150840340c65edf39e2e52cbf8d | |
parent | 39963a61d44dfd43a186f78e7dd0ca13b5e68fd6 (diff) | |
download | org-mode-03c0ab007954be7ecd22dba11575c66795b9f905.tar.gz |
org-effectiveness.el: Add org-effectiveness-plot-save
* contrib/lisp/org-effectiveness.el (org-effectiveness-plot): Adapt source to save as file image.
(org-effectiveness-plot-save): Add function.
-rw-r--r-- | contrib/lisp/org-effectiveness.el | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/contrib/lisp/org-effectiveness.el b/contrib/lisp/org-effectiveness.el index 1e80d1f..0d830ab 100644 --- a/contrib/lisp/org-effectiveness.el +++ b/contrib/lisp/org-effectiveness.el @@ -127,7 +127,7 @@ many TODO pending" (concat "0" (number-to-string m)) (number-to-string m))) -(defun org-effectiveness-plot(startdate enddate) +(defun org-effectiveness-plot(startdate enddate &optional save) (interactive "sGive me the start date: \nsGive me the end date: " startdate enddate) (setq dates (org-effectiveness-check-dates startdate enddate)) (setq syear (cadr (assoc 'startyear dates))) @@ -165,10 +165,20 @@ many TODO pending" (setq month (+ 1 month)))) (write-region str nil "/tmp/org-effectiveness")) ;; Create the bar graph + (if (eq save t) + (setq strplot "/usr/bin/gnuplot -e 'set term png; set output \"/tmp/org-effectiveness.png\"; plot \"/tmp/org-effectiveness\" using 2:xticlabels(1) with histograms' -p") + (setq strplot "/usr/bin/gnuplot -e 'plot \"/tmp/org-effectiveness\" using 2:xticlabels(1) with histograms' -p")) (if (file-exists-p "/usr/bin/gnuplot") - (call-process "/bin/bash" nil t nil "-c" "/usr/bin/gnuplot -e 'plot \"/tmp/org-effectiveness\" using 2:xticlabels(1) with histograms' -p") + (call-process "/bin/bash" nil t nil "-c" strplot) (message "gnuplot is not installed"))) +(defun org-effectiveness-plot-save(startdate enddate &optional save) + (interactive "sGive me the start date: \nsGive me the end date: " startdate enddate) + (org-effectiveness-plot startdate enddate t)) + +;; (defun org-effectiveness-plot(startdate enddate) + + (defun org-effectiveness-ascii-bar(n &optional label) "Print a bar with the percentage from 0 to 100 printed in ascii" (interactive "nPercentage: \nsLabel: ") |