summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Arroyo Menéndez <davidam@gmail.com>2014-10-15 14:58:13 +0200
committerDavid Arroyo Menéndez <davidam@gmail.com>2014-10-15 14:58:13 +0200
commit03c0ab007954be7ecd22dba11575c66795b9f905 (patch)
tree524d2f403f137150840340c65edf39e2e52cbf8d
parent39963a61d44dfd43a186f78e7dd0ca13b5e68fd6 (diff)
downloadorg-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.el14
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: ")