r19989 - gnucash/trunk/src/report/standard-reports - Adds percentages to piecharts. See bug #343449 for details. Patch is derived from a patch submitted by Alexander Weiss

Mike Evans mikee at code.gnucash.org
Wed Dec 29 07:30:13 EST 2010


Author: mikee
Date: 2010-12-29 07:30:13 -0500 (Wed, 29 Dec 2010)
New Revision: 19989
Trac: http://svn.gnucash.org/trac/changeset/19989

Modified:
   gnucash/trunk/src/report/standard-reports/account-piecharts.scm
Log:
Adds percentages to piecharts.  See bug #343449 for details.  Patch is derived from a patch submitted by Alexander Weiss

Modified: gnucash/trunk/src/report/standard-reports/account-piecharts.scm
===================================================================
--- gnucash/trunk/src/report/standard-reports/account-piecharts.scm	2010-12-29 03:03:10 UTC (rev 19988)
+++ gnucash/trunk/src/report/standard-reports/account-piecharts.scm	2010-12-29 12:30:13 UTC (rev 19989)
@@ -69,6 +69,7 @@
 
 (define optname-fullname (N_ "Show long account names"))
 (define optname-show-total (N_ "Show Totals"))
+(define optname-show-percent (N_ "Show Percents"))
 (define optname-slices (N_ "Maximum Slices"))
 (define optname-plot-width (N_ "Plot Width"))
 (define optname-plot-height (N_ "Plot Height"))
@@ -162,6 +163,13 @@
       gnc:pagename-display optname-show-total
       "b" (N_ "Show the total balance in legend?") #t))
 
+
+     (add-option
+      (gnc:make-simple-boolean-option
+       gnc:pagename-display optname-show-percent
+       "b" (N_ "Show the percentage in legend?") #t))
+
+
     (add-option
      (gnc:make-number-range-option
       gnc:pagename-display optname-slices
@@ -221,6 +229,7 @@
 
         (show-fullname? (get-option gnc:pagename-display optname-fullname))
         (show-total? (get-option gnc:pagename-display optname-show-total))
+        (show-percent? (get-option gnc:pagename-display optname-show-percent))
         (max-slices (inexact->exact
 		     (get-option gnc:pagename-display optname-slices)))
         (height (get-option gnc:pagename-display optname-plot-height))
@@ -499,8 +508,15 @@
 				  (car pair)
 				  (gnc-commodity-get-fraction report-currency)
 				  GNC-RND-ROUND)
-				 print-info))
-			       "")))
+ 				 print-info)
+ 				 )
+ 			       "")
+ 			   (if show-percent?
+ 				(sprintf
+ 				 #f "   (%2.2f %%)"
+ 				 (* 100.0 (/ (car pair) (apply + (unzip1 combined)))))
+ 			       "")
+ 			       ))
                        combined)))
                  (gnc:html-piechart-set-labels! chart legend-labels))
 



More information about the gnucash-changes mailing list