* [ANN] Small improvements in Columns view
@ 2016-02-25 0:07 Nicolas Goaziou
0 siblings, 0 replies; only message in thread
From: Nicolas Goaziou @ 2016-02-25 0:07 UTC (permalink / raw)
To: Org Mode List
Hello,
It is now possible to use custom summaries in Columns view, and re-use
the same property in multiple columns.
In the latter situation, the first columns referencing the property
determines how the values for that property are to be computed.
The following example illustrates these features:
(defun my-Med (values printf)
(let ((v (sort (mapcar #'string-to-number values) #'<))
(l (length values)))
(number-to-string
(if (= (% l 2) 1) (nth (floor l 2) v)
(let ((m (/ l 2)))
(/ (+ (nth m v) (nth (1+ m) v)) 2.0))))))
(defun my-Q1 (values printf)
(number-to-string
(nth (floor (length values) 4)
(sort (mapcar #'string-to-number values) #'<))))
(defun my-Q3 (values printf)
(number-to-string
(nth (floor (* (length values) 0.75))
(sort (mapcar #'string-to-number values) #'<))))
(add-to-list 'org-columns-summary-types '("Med" . my-Med))
(add-to-list 'org-columns-summary-types '("Q1" . my-Q1))
(add-to-list 'org-columns-summary-types '("Q3" . my-Q3))
#+COLUMNS: %ITEM %VALUE(Min){min} %VALUE(Q1){Q1} %VALUE(Med){Med} %VALUE(Q3){Q3} %VALUE(Max){max}
* H
** S1
:PROPERTIES:
:VALUE: 2
:END:
** S2
:PROPERTIES:
:VALUE: 1
:END:
** S3
:PROPERTIES:
:VALUE: 9
:END:
** S4
:PROPERTIES:
:VALUE: 7
:END:
Feedback welcome.
Regards,
--
Nicolas Goaziou 0x80A93738
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2016-02-25 0:05 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-02-25 0:07 [ANN] Small improvements in Columns view Nicolas Goaziou
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).