gnucash maint: Bug 797878 - Pie chart displays fractions and long decimal representations
Christopher Lam
clam at code.gnucash.org
Thu Jul 30 06:10:00 EDT 2020
Updated via https://github.com/Gnucash/gnucash/commit/f71af666 (commit)
from https://github.com/Gnucash/gnucash/commit/b36a0125 (commit)
commit f71af6669a75c21000ba4dc29e266e28ff63844c
Author: Christopher Lam <christopher.lck at gmail.com>
Date: Thu Jul 30 17:46:38 2020 +0800
Bug 797878 - Pie chart displays fractions and long decimal representations
ensure amounts rendering is rounded to report-currency SCU
diff --git a/gnucash/report/reports/standard/account-piecharts.scm b/gnucash/report/reports/standard/account-piecharts.scm
index c941ff413..19d30067d 100644
--- a/gnucash/report/reports/standard/account-piecharts.scm
+++ b/gnucash/report/reports/standard/account-piecharts.scm
@@ -415,8 +415,7 @@ balance at a given time"))
((WeekDelta) (string-append report-title " " (G_ "Weekly Average")))
(else report-title)))
(combined '())
- (other-anchor "")
- (print-info (gnc-commodity-print-info report-currency #t)))
+ (other-anchor ""))
;; Converts a commodity-collector into one single inexact
;; number, depending on the report's currency and the
@@ -525,7 +524,12 @@ balance at a given time"))
((if show-fullname?
gnc-account-get-full-name
xaccAccountGetName) acct))))))))
- combined))))
+ combined)))
+ (scu (gnc-commodity-get-fraction report-currency)))
+
+ (define (round-scu amt)
+ (gnc-numeric-convert amt scu GNC-HOW-RND-ROUND))
+
(gnc:html-chart-set-type! chart 'pie)
(gnc:html-chart-set-currency-iso!
@@ -550,13 +554,14 @@ balance at a given time"))
#f ": ~a"
(gnc:monetary->string
(gnc:make-gnc-monetary
- report-currency total))))
+ report-currency
+ (round-scu total)))))
""))))
(gnc:html-chart-set-width! chart width)
(gnc:html-chart-set-height! chart height)
(gnc:html-chart-add-data-series! chart
"Accounts"
- (unzip1 combined)
+ (map round-scu (unzip1 combined))
(gnc:assign-colors (length combined))
'urls urls)
(gnc:html-chart-set-axes-display! chart #f)
@@ -575,7 +580,7 @@ balance at a given time"))
(gnc:monetary->string
(gnc:make-gnc-monetary
report-currency
- (car series))))
+ (round-scu (car series)))))
"")
(if show-percent?
(format #f " (~2,1f%)"
Summary of changes:
gnucash/report/reports/standard/account-piecharts.scm | 17 +++++++++++------
1 file changed, 11 insertions(+), 6 deletions(-)
More information about the gnucash-changes
mailing list