I'm trying to create a stacked bar chart graph where the total for
each period on the x-axis is 100%, so you can easily see trends in
changes in the proportion of individual accounts relative to the
total.
I'm using category-barchart.scm as a starting point, where account
balances are stored as a list of pairs (<account> <balance-list>) in
the variable all-data, and <balance-list> is a list of gnc:monetary
values (or something like that?) for each period on the x-axis.
I can get totals for each period with:
(let ((totals
(map
(lambda (l) (apply gnc:monetary+ l))
(apply zip (map cadr all-data)))))
(set! all-data-totals (list "Total" totals)))
However, I'm not sure how to divide gnc:monetary values by other
gnc:monetary values. I know I can add with:
(for-each
(lambda (d)
(let ((new-data (map gnc:monetary+ (cadr d) (cadr d))))
(set! all-data-new
(append all-data-new
(list (car d) new-data)))))
all-data)
But I'm not sure how to divide. Something like:
(map gnc:monetary/ (cadr all-data-totals) (cadr d))
Of course, "gnc:monetary/" is undefined, and simply using "/" does not
work either. Is there any way to do this? Any help would be appreciated.
Thanks,
E
_______________________________________________
gnucash-user mailing list
[email protected]
To update your subscription preferences or to unsubscribe:
https://lists.gnucash.org/mailman/listinfo/gnucash-user
If you are using Nabble or Gmane, please see
https://wiki.gnucash.org/wiki/Mailing_Lists for more information.
-----
Please remember to CC this list on all your replies.
You can do this by using Reply-To-List or Reply-All.