Christian Stimming's report patch.

* src/gnome/gnc-html-guppi.c, src/scm/html-barchart.scm: Added new
	option for barchart: legend-reversed.


git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@3890 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
Dave Peticolas
2001-04-04 08:52:57 +00:00
parent 034312146a
commit 1e0a0706c2
5 changed files with 64 additions and 23 deletions

View File

@@ -1,3 +1,8 @@
2001-04-04 Christian Stimming <stimming@tuhh.de>
* src/gnome/gnc-html-guppi.c, src/scm/html-barchart.scm: Added new
option for barchart: legend-reversed.
2001-04-04 Robert Graham Merkel <rgmerk@mira.net>
* src/scm/report/balance-sheet.scm: calculate retained profits

View File

@@ -513,6 +513,7 @@ gnc_html_embedded_barchart(gnc_html * parent,
char * param;
int datarows=0;
int datacols=0;
int legend_reversed=0;
int rotate=0;
int stacked=0;
int normalize_stacks=0;
@@ -590,6 +591,13 @@ gnc_html_embedded_barchart(gnc_html * parent,
GTK_VALUE_BOOL(arglist[argind]) = rotate;
argind++;
}
if((param = g_hash_table_lookup(params, "legend_reversed")) != NULL) {
sscanf(param, "%d", &rotate);
arglist[argind].name = "legend_reversed";
arglist[argind].type = GTK_TYPE_BOOL;
GTK_VALUE_BOOL(arglist[argind]) = rotate;
argind++;
}
if((param = g_hash_table_lookup(params, "stacked")) != NULL) {
sscanf(param, "%d", &stacked);
arglist[argind].name = "stacked";

View File

@@ -34,6 +34,7 @@
col-labels
row-labels
col-colors
legend-reversed?
row-labels-rotated?
stacked?
data
@@ -55,7 +56,7 @@
(define (gnc:make-html-barchart)
(gnc:make-html-barchart-internal -1 -1 #f #f #f #f '() '() '()
#f #f '() #f #f #f #f #f #f))
#f #f #f '() #f #f #f #f #f #f))
(define gnc:html-barchart-data
(record-accessor <html-barchart> 'data))
@@ -117,6 +118,12 @@
(define gnc:html-barchart-set-col-colors!
(record-modifier <html-barchart> 'col-colors))
(define gnc:html-barchart-legend-reversed?
(record-accessor <html-barchart> 'legend-reversed?))
(define gnc:html-barchart-set-legend-reversed?!
(record-modifier <html-barchart> 'legend-reversed?))
(define gnc:html-barchart-title
(record-accessor <html-barchart> 'title))
@@ -396,13 +403,18 @@
(push " <param name=\"col_labels\" value=\"")
(push col-labels)
(push "\">\n")))
(let ((rot? (gnc:html-barchart-row-labels-rotated? barchart)))
(push " <param name=\"rotate_row_labels\" value=\"")
(if rot?
(push "1\">\n")
(push "0\">\n")))
(if (gnc:html-barchart-stacked? barchart)
(push " <param name=\"stacked\" value=\"1\">\n"))
(push " <param name=\"rotate_row_labels\" value=\"")
(push (if (gnc:html-barchart-row-labels-rotated? barchart)
"1\">\n"
"0\">\n"))
(push " <param name=\"stacked\" value=\"")
(push (if (gnc:html-barchart-stacked? barchart)
"1\">\n"
"0\">\n"))
(push " <param name=\"legend_reversed\" value=\"")
(push (if (gnc:html-barchart-legend-reversed? barchart)
"1\">\n"
"0\">\n"))
(push "Unable to push bar chart\n")
(push "</object> &nbsp;\n"))
" ")

View File

@@ -89,10 +89,23 @@
;; Builds and returns a tree-(hierarchy-)shaped table as a html-table
;; object.
;;
;; Arguments by topic:
;;
;; Reporting period -- start-date, end-date
;;
;; Selected accounts -- tree-depth, show-subaccts?, accounts,
;; do-subtot?
;;
;; Foreign currency -- show-other-curr?, report-commodity,
;; exchange-fn
;;
;; Output fine-tuning -- show-col-headers?, show-total? (with
;; total-name, get-total-fn), group-types?
;;
;; Note: The returned table object will have 2*tree-depth columns if
;; show-other-curr?==#f, else it will have 3*tree-depth columns.
;;
;; Arguments:
;; Arguments in detail:
;;
;; <gnc:time-pair> start-date: Start date of reporting period. If #f,
;; everything till end-date will be considered.
@@ -106,7 +119,10 @@
;; are totally independent from the calculated balance and vice
;; versa.
;;
;; <bool> show-total? If #f, no total sum is shown.
;; <bool> show-col-headers?: show column headings "Account" and
;; "Balance"
;;
;; <bool> show-total?: If #f, no total sum is shown.
;;
;; #<procedure ...> get-total-fn: The function to calculate the total
;; sum, e.g. gnc:accounts-get-comm-total-{profit,assets}.
@@ -119,8 +135,6 @@
;; <bool> do-subtot?: Specify whether to include sub-account balances
;; in each account's balance.
;;
;; <bool> col-headers? : show column headings "Account" and "Balance"
;;
;; <bool> show-other-curr?, <gnc:commodity*> report-commodity,
;; #<procedure ...> exchange-fn: The rightmost column always shows
;; balances in the currency report-commodity. If those balances happen
@@ -443,15 +457,15 @@
;; set some column headers
(if show-col-headers?
(gnc:html-table-set-col-headers!
(gnc:html-table-set-col-headers!
table
(list (gnc:make-html-table-header-cell/size
1 tree-depth (_ "Account name"))
(gnc:make-html-table-header-cell/size
1 (if show-other-curr?
(* 2 tree-depth)
tree-depth)
(_ "Balance")))))
(list (gnc:make-html-table-header-cell/size
1 tree-depth (_ "Account name"))
(gnc:make-html-table-header-cell/size
1 (if show-other-curr?
(* 2 tree-depth)
tree-depth)
(_ "Balance")))))
;; there are tree-depth account name columns.
(let loop ((col 0))

View File

@@ -27,11 +27,11 @@
(gnc:depend "date-utilities.scm")
;; The option names are defined here to a) save typing and b) avoid
;; spelling errors. The reportnames are defined here (and not only
;; spelling errors. The *reportnames* are defined here (and not only
;; once at the very end) because I need them to define the "other"
;; report, thus needing them twice.
(let ((reportname-income (N_ "Income Category Barchart"))
(reportname-expense (N_ "Expense Category Barchart"))
(let ((reportname-income (N_ "Income Barchart"))
(reportname-expense (N_ "Expense Barchart"))
(pagename-general (N_ "General"))
(optname-from-date (N_ "From"))
@@ -295,6 +295,8 @@
chart (gnc:commodity-get-mnemonic report-currency))
(gnc:html-barchart-set-row-labels-rotated?! chart #t)
(gnc:html-barchart-set-stacked?! chart stacked?)
;; If this is a stacked barchart, then reverse the legend.
(gnc:html-barchart-set-legend-reversed?! chart stacked?)
;; If we have too many categories, we sum them into a new
;; 'other' category and add a link to a new report with just