summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJSDurand <mmemmew@gmail.com>2023-09-06 14:42:19 +0800
committerJSDurand <mmemmew@gmail.com>2023-09-06 14:42:19 +0800
commitc0e7b1bc0dc1fec9af3d60adba5620abba2756d6 (patch)
tree1cb88cb76d03d62019209d34d738b6b94904f95c
parent70fedd989f461d18f1954e1e6c0d24eab80363ae (diff)
account: modify svg and move all-cost to the front
* account.el (account-agenda-command, account-agenda-shop-command): Display the sum of all costs at the beginning instead of at the end. This is more convenient. (account-agenda-export-to-svg): Fix the widths of blocks of each day in the output SVG to be 150, and the total width of the image will depend on the number of days to display. This is necessary if I want to put text under the blocks.
-rw-r--r--account.el32
1 files changed, 18 insertions, 14 deletions
diff --git a/account.el b/account.el
index b17f304..c6b01bf 100644
--- a/account.el
+++ b/account.el
@@ -569,11 +569,19 @@ MATCH is required by Org-agenda, and relentlessly ignored by us."
titles account-agenda-collector)))
(mapc
(lambda (element)
+ (setq all-cost (+ all-cost (car (cdr element)))))
+ info)
+ (insert
+ (propertize
+ (format "all: %d" all-cost)
+ 'face 'org-agenda-calendar-event))
+ (newline 2)
+ (mapc
+ (lambda (element)
(let* ((title (car element))
(cost (car (cdr element)))
(date (get-text-property 0 'date title))
(date-face (org-agenda-get-day-face date)))
- (setq all-cost (+ all-cost cost))
(insert (propertize title 'face date-face))
(newline)
(mapc
@@ -596,11 +604,6 @@ MATCH is required by Org-agenda, and relentlessly ignored by us."
'date date)))
(newline))
info)
- (newline 2)
- (insert
- (propertize
- (format "all: %d" all-cost)
- 'face 'org-agenda-calendar-event))
(newline)
(goto-char (point-min))
(account-mode)))
@@ -679,6 +682,11 @@ MATCH is required by Org-agenda, and relentlessly ignored by us."
shop-cost-alist
(lambda (cell1 cell2)
(>= (cdr cell1) (cdr cell2)))))
+ (insert
+ (propertize
+ (format "all: %d" all-cost)
+ 'face 'org-agenda-calendar-event))
+ (newline 2)
(mapc
(lambda (cell)
(insert
@@ -690,11 +698,6 @@ MATCH is required by Org-agenda, and relentlessly ignored by us."
'face 'org-agenda-calendar-event))
(newline))
shop-cost-alist)
- (newline 2)
- (insert
- (propertize
- (format "all: %d" all-cost)
- 'face 'org-agenda-calendar-event))
(newline)
(goto-char (point-min))
(account-mode)))
@@ -932,13 +935,14 @@ a match."
(setq temp (cdr temp))))
(require 'svg)
(let* ((len (length result))
- (block-width (/ 800.0 len))
+ (block-width 115)
+ (width (ceiling (* block-width len)))
(index 0)
(start 0)
- (svg (svg-create 800 700 :stroke-width 10)))
+ (svg (svg-create width 700 :stroke-width 10)))
(svg-circle
svg
- 400 350 1000
+ (ceiling width 2) 350 (max width 1000)
:fill-color "white")
(mapc
(lambda (cell)