0
0
Fork 1
mirror of https://git.savannah.gnu.org/git/emacs/org-mode.git synced 2024-09-29 19:07:52 +00:00

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.
This commit is contained in:
David Arroyo Menéndez 2014-10-15 14:58:13 +02:00
parent 39963a61d4
commit 03c0ab0079

View file

@ -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: ")