[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[O] [ANN] Small improvements in Columns view
From: |
Nicolas Goaziou |
Subject: |
[O] [ANN] Small improvements in Columns view |
Date: |
Thu, 25 Feb 2016 01:07:41 +0100 |
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
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [O] [ANN] Small improvements in Columns view,
Nicolas Goaziou <=