diff --git a/ChangeLog b/ChangeLog index 03cf26babd..49eba00093 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,21 @@ +2001-03-29 Christian Stimming + + * src/scm/report/report-list.scm, Makefile.am: Added new file. + + * src/scm/report/category-barchart.scm: Two new reports. Shows + barchart of income (or expense) categories over time. + + * src/scm/report/income-expense-graph.scm: Use more + option-utilities.scm. Fixed gnc:dateloop usage (last interval was + wrong). + + * src/scm/html-barchart.scm: Added record components for bar- and + legend-urls and their accessor/modifier functions. FIXME: They + don't get rendered yet -- somebody has to add that. + + * src/scm/date-utilities.scm (gnc:dateloop): Fixed last interval + not to be longer than the specified end date. + 2001-03-29 James LewisMoss * src/engine/io-gncxml-v2.c (write_counts): don't add an amount if diff --git a/src/scm/date-utilities.scm b/src/scm/date-utilities.scm index 7ba9210631..d7064d65b6 100644 --- a/src/scm/date-utilities.scm +++ b/src/scm/date-utilities.scm @@ -195,12 +195,18 @@ (gnc:timepair-eq (gnc:timepair-canonical-day-time t1) (gnc:timepair-canonical-day-time t2))) -;; Build a list of time intervals +;; Build a list of time intervals. +;; +;; Note that the last interval will be shorter than if +;; (-) is not an integer multiple of . If you don't +;; want that you'll have to write another function. (define (gnc:dateloop curd endd incr) (cond ((gnc:timepair-later curd endd) (let ((nextd (incdate curd incr))) - (cons (list curd (decdate nextd SecDelta) '()) - (gnc:dateloop nextd endd incr)))) + (cond ((gnc:timepair-later nextd endd) + (cons (list curd (decdate nextd SecDelta) '()) + (gnc:dateloop nextd endd incr))) + (else (cons (list curd endd '()) '()))))) (else '()))) ; A reference zero date - the Beginning Of The Epoch diff --git a/src/scm/html-barchart.scm b/src/scm/html-barchart.scm index 2e42f80cf8..ff7495c0d0 100644 --- a/src/scm/html-barchart.scm +++ b/src/scm/html-barchart.scm @@ -36,7 +36,11 @@ col-colors row-labels-rotated? stacked? - data))) + data + button-1-bar-urls button-2-bar-urls + button-3-bar-urls + button-1-legend-urls button-2-legend-urls + button-3-legend-urls))) (define gnc:html-barchart? (record-predicate )) @@ -50,7 +54,8 @@ (record-constructor )) (define (gnc:make-html-barchart) - (gnc:make-html-barchart-internal -1 -1 #f #f #f #f '() '() '() #f #f '())) + (gnc:make-html-barchart-internal -1 -1 #f #f #f #f '() '() '() + #f #f '() #f #f #f #f #f #f)) (define gnc:html-barchart-data (record-accessor 'data)) @@ -124,6 +129,42 @@ (define gnc:html-barchart-set-subtitle! (record-modifier 'subtitle)) +(define gnc:html-barchart-button-1-bar-urls + (record-accessor 'button-1-bar-urls)) + +(define gnc:html-barchart-set-button-1-bar-urls! + (record-modifier 'button-1-bar-urls)) + +(define gnc:html-barchart-button-2-bar-urls + (record-accessor 'button-2-bar-urls)) + +(define gnc:html-barchart-set-button-2-bar-urls! + (record-modifier 'button-2-bar-urls)) + +(define gnc:html-barchart-button-3-bar-urls + (record-accessor 'button-3-bar-urls)) + +(define gnc:html-barchart-set-button-3-bar-urls! + (record-modifier 'button-3-bar-urls)) + +(define gnc:html-barchart-button-1-legend-urls + (record-accessor 'button-1-legend-urls)) + +(define gnc:html-barchart-set-button-1-legend-urls! + (record-modifier 'button-1-legend-urls)) + +(define gnc:html-barchart-button-2-legend-urls + (record-accessor 'button-2-legend-urls)) + +(define gnc:html-barchart-set-button-2-legend-urls! + (record-modifier 'button-2-legend-urls)) + +(define gnc:html-barchart-button-3-legend-urls + (record-accessor 'button-3-legend-urls)) + +(define gnc:html-barchart-set-button-3-legend-urls! + (record-modifier 'button-3-legend-urls)) + (define (gnc:html-barchart-append-row! barchart newrow) (let ((dd (gnc:html-barchart-data barchart))) (set! dd (append dd (list newrow))) diff --git a/src/scm/options-utilities.scm b/src/scm/options-utilities.scm index 126db2feb5..4457e8cd4f 100644 --- a/src/scm/options-utilities.scm +++ b/src/scm/options-utilities.scm @@ -71,12 +71,12 @@ ;; A date interval multichoice option. (define (gnc:options-add-interval-choice! - options pagename optname sort-tag) + options pagename optname sort-tag default) (gnc:register-option options (gnc:make-multichoice-option pagename optname - sort-tag (_ "The amount of time between data points") 'WeekDelta + sort-tag (_ "The amount of time between data points") default (list (vector 'DayDelta (_ "Day") (_ "Day")) (vector 'WeekDelta (_ "Week") (_ "Week")) (vector 'TwoWeekDelta (_ "2Week") (_ "Two Week")) diff --git a/src/scm/report/Makefile.am b/src/scm/report/Makefile.am index bbc75919ac..df11072b0c 100644 --- a/src/scm/report/Makefile.am +++ b/src/scm/report/Makefile.am @@ -4,20 +4,21 @@ gncscmdir = ${GNC_SCM_INSTALL_DIR}/report gncscm_DATA = \ account-summary.scm \ average-balance.scm \ - pnl.scm \ + category-barchart.scm \ + hello-world.scm \ income-expense-graph.scm \ income-or-expense-pie.scm \ - hello-world.scm \ + pnl.scm \ portfolio.scm \ register.scm \ report-list.scm \ - stylesheet-plain.scm \ stylesheet-fancy.scm \ + stylesheet-plain.scm \ table-test.scm \ taxtxf.scm \ - txf-export.scm \ - txf-export-help.scm \ transaction-report.scm \ + txf-export-help.scm \ + txf-export.scm \ view-column.scm EXTRA_DIST = \ diff --git a/src/scm/report/average-balance.scm b/src/scm/report/average-balance.scm index 0acea9b065..256a8ebff9 100644 --- a/src/scm/report/average-balance.scm +++ b/src/scm/report/average-balance.scm @@ -52,7 +52,7 @@ #f #t)) (gnc:options-add-interval-choice! - options pagename-general (N_ "Step Size") "b") + options pagename-general (N_ "Step Size") "b" 'TwoWeekDelta) (register-option (gnc:make-simple-boolean-option diff --git a/src/scm/report/income-expense-graph.scm b/src/scm/report/income-expense-graph.scm index a6766e2ca7..205defb9c3 100644 --- a/src/scm/report/income-expense-graph.scm +++ b/src/scm/report/income-expense-graph.scm @@ -35,7 +35,7 @@ optname-from-date optname-to-date "a") (gnc:options-add-interval-choice! - options pagename-general optname-stepsize "b") + options pagename-general optname-stepsize "b" 'MonthDelta) (add-option (gnc:make-account-list-option @@ -51,14 +51,8 @@ (filter gnc:account-is-inc-exp? accounts))) #t)) - (add-option - (gnc:make-currency-option - pagename-general optname-report-currency - "d" - (_ "Select the display value for the currency") - (gnc:option-value - (gnc:lookup-global-option "International" - "Default Currency")))) + (gnc:options-add-currency! + options pagename-general optname-report-currency "d") (add-option (gnc:make-simple-boolean-option @@ -75,8 +69,9 @@ pagename-display optname-stacked "ba" (_ "Show barchart as stacked?") #f)) - (gnc:options-add-plot-size! options pagename-display - optname-plot-width optname-plot-height "c" 400 400) + (gnc:options-add-plot-size! + options pagename-display + optname-plot-width optname-plot-height "c" 400 400) (gnc:options-set-default-section options pagename-general) @@ -144,10 +139,8 @@ (exchange-fn (lambda (foreign) (exchange-fn-internal foreign report-currency))) (dates-list (gnc:dateloop - ;; FIXME: gnc:dateloop is toast (see ML) (gnc:timepair-start-day-time from-date-tp) - (gnc:timepair-end-day-time - (decdate to-date-tp DayDelta)) + (gnc:timepair-end-day-time to-date-tp) (eval interval))) (income-collector-fn (collector-fn accounts #t)) (expense-collector-fn (collector-fn accounts #f)) diff --git a/src/scm/report/report-list.scm b/src/scm/report/report-list.scm index 67c844c680..db1df6196a 100644 --- a/src/scm/report/report-list.scm +++ b/src/scm/report/report-list.scm @@ -10,6 +10,7 @@ (gnc:depend "report/average-balance.scm") (gnc:depend "report/income-expense-graph.scm") (gnc:depend "report/income-or-expense-pie.scm") +(gnc:depend "report/category-barchart.scm") (gnc:depend "report/pnl.scm") (gnc:depend "report/hello-world.scm") (gnc:depend "report/portfolio.scm")