r22223 - gnucash/branches/2.4/src - Bug #677570 - Error creating net worth linechart report
Mike Evans
mikee at code.gnucash.org
Sat Jun 16 09:30:21 EDT 2012
Author: mikee
Date: 2012-06-16 09:30:21 -0400 (Sat, 16 Jun 2012)
New Revision: 22223
Trac: http://svn.gnucash.org/trac/changeset/22223
Modified:
gnucash/branches/2.4/src/html/gnc-html-graph-gog-webkit.c
gnucash/branches/2.4/src/html/gnc-html-graph-gog.c
gnucash/branches/2.4/src/html/gnc-html-graph-gog.h
gnucash/branches/2.4/src/report/report-system/html-linechart.scm
gnucash/branches/2.4/src/report/report-system/report-system.scm
gnucash/branches/2.4/src/report/standard-reports/net-linechart.scm
Log:
Bug #677570 - Error creating net worth linechart report
Remove doubled file contents.
Changeset 21628 has already done this for trunk.
Modified: gnucash/branches/2.4/src/html/gnc-html-graph-gog-webkit.c
===================================================================
--- gnucash/branches/2.4/src/html/gnc-html-graph-gog-webkit.c 2012-06-16 11:52:51 UTC (rev 22222)
+++ gnucash/branches/2.4/src/html/gnc-html-graph-gog-webkit.c 2012-06-16 13:30:21 UTC (rev 22223)
@@ -420,6 +420,7 @@
lineChartInfo.markers = get_int_param( &object_info, "markers" );
lineChartInfo.major_grid = get_int_param( &object_info, "major_grid" );
lineChartInfo.minor_grid = get_int_param( &object_info, "minor_grid" );
+ lineChartInfo.line_width = get_int_param( &object_info, "line_width" );
pixbuf = gnc_html_graph_gog_create_linechart( &lineChartInfo );
if ( lineChartInfo.title != NULL ) g_free( (gchar*)lineChartInfo.title );
Modified: gnucash/branches/2.4/src/html/gnc-html-graph-gog.c
===================================================================
--- gnucash/branches/2.4/src/html/gnc-html-graph-gog.c 2012-06-16 11:52:51 UTC (rev 22222)
+++ gnucash/branches/2.4/src/html/gnc-html-graph-gog.c 2012-06-16 13:30:21 UTC (rev 22223)
@@ -379,7 +379,7 @@
}
g_object_set( G_OBJECT(plot),
- //"vary_style_by_element", TRUE,
+ "vary_style_by_element", FALSE,
"type", line_type,
"default-style-has-markers", info->markers,
NULL);
@@ -413,9 +413,9 @@
style->fill.type = GO_STYLE_FILL_PATTERN;
if ( gdk_color_parse( info->col_colors[i], &color ) )
{
- //style->line.width = 1; TODO: Should be settable from report.scm
- style->line.auto_color = FALSE;
- style->line.color = GO_COLOR_FROM_GDK(color);
+ style->line.width = info->line_width;
+ style->line.auto_color = FALSE;
+ style->line.color = GO_COLOR_FROM_GDK(color);
}
else
{
@@ -432,15 +432,15 @@
go_style_set_text_angle( style, 90.0 );
}
- if ( info->major_grid || info->minor_grid )
+ if ( info->major_grid || info->minor_grid )
{
GogObject *object;
- gog_object_add_by_name( chart, "Grid", NULL );
+
object = gog_object_get_child_by_role( chart,
- gog_object_find_role_by_name( chart, "Y-Axis" ) );
+ gog_object_find_role_by_name( chart, "Y-Axis" ) );
if ( info->major_grid )
{
- gog_object_add_by_name( GOG_OBJECT(object), "MajorGrid", NULL );
+ gog_object_add_by_name( GOG_OBJECT(object), "MajorGrid", NULL );
}
if ( info->minor_grid )
{
Modified: gnucash/branches/2.4/src/html/gnc-html-graph-gog.h
===================================================================
--- gnucash/branches/2.4/src/html/gnc-html-graph-gog.h 2012-06-16 11:52:51 UTC (rev 22222)
+++ gnucash/branches/2.4/src/html/gnc-html-graph-gog.h 2012-06-16 13:30:21 UTC (rev 22223)
@@ -74,6 +74,7 @@
gboolean minor_grid;
const gchar* x_axis_label;
const gchar* y_axis_label;
+ gint line_width;
} GncHtmlLineChartInfo;
typedef struct
Modified: gnucash/branches/2.4/src/report/report-system/html-linechart.scm
===================================================================
--- gnucash/branches/2.4/src/report/report-system/html-linechart.scm 2012-06-16 11:52:51 UTC (rev 22222)
+++ gnucash/branches/2.4/src/report/report-system/html-linechart.scm 2012-06-16 13:30:21 UTC (rev 22223)
@@ -1,482 +1,5 @@
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; html-linechart.scm : generate HTML programmatically, with support
-;; for simple style elements.
-;; Copyright 2008 Sven Henkel <shenkel at gmail.com>
-;;
-;; Adapted from html-barchart.scm which is
-;; Copyright 2000 Bill Gribble <grib at gnumatic.com>
-;;
-;; This program is free software; you can redistribute it and/or
-;; modify it under the terms of the GNU General Public License as
-;; published by the Free Software Foundation; either version 2 of
-;; the License, or (at your option) any later version.
-;;
-;; This program is distributed in the hope that it will be useful,
-;; but WITHOUT ANY WARRANTY; without even the implied warranty of
-;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-;; GNU General Public License for more details.
-;;
-;; You should have received a copy of the GNU General Public License
-;; along with this program; if not, contact:
-;;
-;; Free Software Foundation Voice: +1-617-542-5942
-;; 51 Franklin Street, Fifth Floor Fax: +1-617-542-2652
-;; Boston, MA 02110-1301, USA gnu at gnu.org
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-
-(define <html-linechart>
- (make-record-type "<html-linechart>"
- '(width
- height
- title
- subtitle
- x-axis-label
- y-axis-label
- col-labels
- row-labels
- col-colors
- legend-reversed?
- row-labels-rotated?
- stacked?
- markers?
- major-grid?
- minor-grid?
- data
- button-1-line-urls
- button-2-line-urls
- button-3-line-urls
- button-1-legend-urls
- button-2-legend-urls
- button-3-legend-urls)))
-
-(define gnc:html-linechart?
- (record-predicate <html-linechart>))
-
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-;; <html-linechart> class
-;; generate the <object> form for a linechart.
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-
-(define gnc:make-html-linechart-internal
- (record-constructor <html-linechart>))
-
-(define (gnc:make-html-linechart)
- (gnc:make-html-linechart-internal -1 -1 #f #f #f #f '() '() '()
- #f #f #f #f #f #f '()
- #f #f #f #f #f #f))
-
-(define gnc:html-linechart-data
- (record-accessor <html-linechart> 'data))
-
-(define gnc:html-linechart-set-data!
- (record-modifier <html-linechart> 'data))
-
-(define gnc:html-linechart-width
- (record-accessor <html-linechart> 'width))
-
-(define gnc:html-linechart-set-width!
- (record-modifier <html-linechart> 'width))
-
-(define gnc:html-linechart-height
- (record-accessor <html-linechart> 'height))
-
-(define gnc:html-linechart-set-height!
- (record-modifier <html-linechart> 'height))
-
-(define gnc:html-linechart-x-axis-label
- (record-accessor <html-linechart> 'x-axis-label))
-
-(define gnc:html-linechart-set-x-axis-label!
- (record-modifier <html-linechart> 'x-axis-label))
-
-(define gnc:html-linechart-y-axis-label
- (record-accessor <html-linechart> 'y-axis-label))
-
-(define gnc:html-linechart-set-y-axis-label!
- (record-modifier <html-linechart> 'y-axis-label))
-
-(define gnc:html-linechart-row-labels
- (record-accessor <html-linechart> 'row-labels))
-
-(define gnc:html-linechart-set-row-labels!
- (record-modifier <html-linechart> 'row-labels))
-
-(define gnc:html-linechart-row-labels-rotated?
- (record-accessor <html-linechart> 'row-labels-rotated?))
-
-(define gnc:html-linechart-set-row-labels-rotated?!
- (record-modifier <html-linechart> 'row-labels-rotated?))
-
-(define gnc:html-linechart-stacked?
- (record-accessor <html-linechart> 'stacked?))
-
-(define gnc:html-linechart-set-stacked?!
- (record-modifier <html-linechart> 'stacked?))
-
-(define gnc:html-linechart-markers?
- (record-accessor <html-linechart> 'markers?))
-
-(define gnc:html-linechart-set-markers?!
- (record-modifier <html-linechart> 'markers?))
-
-(define gnc:html-linechart-major-grid?
- (record-accessor <html-linechart> 'major-grid?))
-
-(define gnc:html-linechart-set-major-grid?!
- (record-modifier <html-linechart> 'major-grid?))
-
-(define gnc:html-linechart-minor-grid?
- (record-accessor <html-linechart> 'minor-grid?))
-
-(define gnc:html-linechart-set-minor-grid?!
- (record-modifier <html-linechart> 'minor-grid?))
-
-(define gnc:html-linechart-col-labels
- (record-accessor <html-linechart> 'col-labels))
-
-(define gnc:html-linechart-set-col-labels!
- (record-modifier <html-linechart> 'col-labels))
-
-(define gnc:html-linechart-col-colors
- (record-accessor <html-linechart> 'col-colors))
-
-(define gnc:html-linechart-set-col-colors!
- (record-modifier <html-linechart> 'col-colors))
-
-(define gnc:html-linechart-legend-reversed?
- (record-accessor <html-linechart> 'legend-reversed?))
-
-(define gnc:html-linechart-set-legend-reversed?!
- (record-modifier <html-linechart> 'legend-reversed?))
-
-(define gnc:html-linechart-title
- (record-accessor <html-linechart> 'title))
-
-(define gnc:html-linechart-set-title!
- (record-modifier <html-linechart> 'title))
-
-(define gnc:html-linechart-subtitle
- (record-accessor <html-linechart> 'subtitle))
-
-(define gnc:html-linechart-set-subtitle!
- (record-modifier <html-linechart> 'subtitle))
-
-;; Note: ATM you can specify one url per column, but this url will be
-;; used for all of the rows. Otherwise we could have cols*rows urls
-;; (quite a lot), but this first requires fixing
-;; guppi_line_1_callback() in gnome/gnc-html-guppi.c .
-(define gnc:html-linechart-button-1-line-urls
- (record-accessor <html-linechart> 'button-1-line-urls))
-
-(define gnc:html-linechart-set-button-1-line-urls!
- (record-modifier <html-linechart> 'button-1-line-urls))
-
-(define gnc:html-linechart-button-2-line-urls
- (record-accessor <html-linechart> 'button-2-line-urls))
-
-(define gnc:html-linechart-set-button-2-line-urls!
- (record-modifier <html-linechart> 'button-2-line-urls))
-
-(define gnc:html-linechart-button-3-line-urls
- (record-accessor <html-linechart> 'button-3-line-urls))
-
-(define gnc:html-linechart-set-button-3-line-urls!
- (record-modifier <html-linechart> 'button-3-line-urls))
-
-(define gnc:html-linechart-button-1-legend-urls
- (record-accessor <html-linechart> 'button-1-legend-urls))
-
-(define gnc:html-linechart-set-button-1-legend-urls!
- (record-modifier <html-linechart> 'button-1-legend-urls))
-
-(define gnc:html-linechart-button-2-legend-urls
- (record-accessor <html-linechart> 'button-2-legend-urls))
-
-(define gnc:html-linechart-set-button-2-legend-urls!
- (record-modifier <html-linechart> 'button-2-legend-urls))
-
-(define gnc:html-linechart-button-3-legend-urls
- (record-accessor <html-linechart> 'button-3-legend-urls))
-
-(define gnc:html-linechart-set-button-3-legend-urls!
- (record-modifier <html-linechart> 'button-3-legend-urls))
-
-(define (gnc:html-linechart-append-row! linechart newrow)
- (let ((dd (gnc:html-linechart-data linechart)))
- (set! dd (append dd (list newrow)))
- (gnc:html-linechart-set-data! linechart dd)))
-
-(define (gnc:html-linechart-prepend-row! linechart newrow)
- (let ((dd (gnc:html-linechart-data linechart)))
- (set! dd (cons newrow dd))
- (gnc:html-linechart-set-data! linechart dd)))
-
-(define (gnc:html-linechart-append-column! linechart newcol)
- (let ((colnum 0)
- (rownum 0)
- (rows (gnc:html-linechart-data linechart))
- (this-row #f)
- (new-row #f))
- ;; find out how many cols are already there in the deepest row
- (for-each
- (lambda (row)
- (let ((l (length row)))
- (if (> l colnum)
- (set! colnum l))))
- rows)
-
- ;; append the elements of 'newrow' to the rowumns
- (for-each
- (lambda (newelt)
- ;; find the row, or append one
- (if (not (null? rows))
- (begin
- (set! new-row #f)
- (set! this-row (car rows))
- (if (null? (cdr rows))
- (set! rows #f)
- (set! rows (cdr rows))))
- (begin
- (set! new-row #t)
- (set! this-row '())))
-
- ;; make sure the rowumn is long enough, then append the data
- (let loop ((l (length this-row))
- (r (reverse this-row)))
- (if (< l colnum)
- (loop (+ l 1) (cons #f r))
- (set! this-row
- (reverse (cons newelt r)))))
- (if new-row
- (gnc:html-linechart-append-row! linechart this-row)
- (list-set! (gnc:html-linechart-data linechart) rownum this-row))
- (set! rownum (+ 1 rownum)))
- newcol)))
-
-(define (gnc:not-all-zeros data)
- (define (myor list)
- (begin
- (gnc:debug "list" list)
- (if (null? list) #f
- (or (car list) (myor (cdr list))))))
-
- (cond ((number? data) (not (= 0 data)))
- ((list? data) (myor (map gnc:not-all-zeros data)))
- (else #f)))
-
-(define (gnc:html-linechart-prepend-column! linechart newcol)
- (let ((rows (gnc:html-linechart-data linechart))
- (this-row #f)
- (new-row #f)
- (rownum 0))
- (for-each
- (lambda (elt)
- (if (not (null? rows))
- (begin
- (set! new-row #f)
- (set! this-row (car rows))
- (if (null? (cdr rows))
- (set! rows #f)
- (set! rows (cdr rows))))
- (begin
- (set! new-row #t)
- (set! this-row '())))
- (if new-row
- (gnc:html-linechart-append-row! linechart (list elt))
- (list-set! (gnc:html-linechart-data linechart) rownum
- (cons elt this-row)))
- (set! rownum (+ 1 rownum)))
- newcol)))
-
-(define (gnc:html-linechart-render linechart doc)
- (define (ensure-numeric elt)
- (cond ((number? elt)
- (exact->inexact elt))
- ((string? elt)
- (with-input-from-string elt
- (lambda ()
- (let ((n (read)))
- (if (number? n) n 0.0)))))
- ((gnc:gnc-numeric? elt)
- (gnc-numeric-to-double elt))
- (#t
- 0.0)))
-
- (define (catenate-escaped-strings nlist)
- (if (not (list? nlist))
- ""
- (with-output-to-string
- (lambda ()
- (for-each
- (lambda (s)
- (let ((escaped
- (regexp-substitute/global
- #f " "
- (regexp-substitute/global
- #f "\\\\" s
- 'pre "\\\\" 'post)
- 'pre "\\ " 'post)))
- (display escaped)
- (display " ")))
- nlist)))))
-
- (let* ((retval '())
- (push (lambda (l) (set! retval (cons l retval))))
- (title (gnc:html-linechart-title linechart))
- (subtitle (gnc:html-linechart-subtitle linechart))
- (url-1
- (catenate-escaped-strings
- (gnc:html-linechart-button-1-line-urls linechart)))
- (url-2
- (catenate-escaped-strings
- (gnc:html-linechart-button-2-line-urls linechart)))
- (url-3
- (catenate-escaped-strings
- (gnc:html-linechart-button-3-line-urls linechart)))
- (legend-1
- (catenate-escaped-strings
- (gnc:html-linechart-button-1-legend-urls linechart)))
- (legend-2
- (catenate-escaped-strings
- (gnc:html-linechart-button-2-legend-urls linechart)))
- (legend-3
- (catenate-escaped-strings
- (gnc:html-linechart-button-3-legend-urls linechart)))
- (x-label (gnc:html-linechart-x-axis-label linechart))
- (y-label (gnc:html-linechart-y-axis-label linechart))
- (data (gnc:html-linechart-data linechart))
- (dummy1 (gnc:debug "data " data))
- (row-labels (catenate-escaped-strings
- (gnc:html-linechart-row-labels linechart)))
- (col-labels (catenate-escaped-strings
- (gnc:html-linechart-col-labels linechart)))
- (col-colors (catenate-escaped-strings
- (gnc:html-linechart-col-colors linechart))))
- (if (and (list? data)
- (not (null? data))
- (gnc:not-all-zeros data))
- (begin
- (push "<object classid=\"")(push GNC-CHART-LINE)(push "\" width=")
- (push (gnc:html-linechart-width linechart))
- (push " height=")
- (push (gnc:html-linechart-height linechart))
- (push ">\n")
- (if title
- (begin
- (push " <param name=\"title\" value=\"")
- (push title) (push "\">\n")))
- (if subtitle
- (begin
- (push " <param name=\"subtitle\" value=\"")
- (push subtitle) (push "\">\n")))
- (if url-1
- (begin
- (push " <param name=\"line_urls_1\" value=\"")
- (push url-1)
- (push "\">\n")))
- (if url-2
- (begin
- (push " <param name=\"line_urls_2\" value=\"")
- (push url-2)
- (push "\">\n")))
- (if url-3
- (begin
- (push " <param name=\"line_urls_3\" value=\"")
- (push url-3)
- (push "\">\n")))
- (if legend-1
- (begin
- (push " <param name=\"legend_urls_1\" value=\"")
- (push legend-1)
- (push "\">\n")))
- (if legend-2
- (begin
- (push " <param name=\"legend_urls_2\" value=\"")
- (push legend-2)
- (push "\">\n")))
- (if legend-3
- (begin
- (push " <param name=\"legend_urls_3\" value=\"")
- (push legend-3)
- (push "\">\n")))
- (if (and data (list? data))
- (let ((rows (length data))
- (cols 0))
- (push " <param name=\"data_rows\" value=\"")
- (push rows) (push "\">\n")
- (if (list? (car data))
- (begin
- (set! cols (length (car data)))
- (push " <param name=\"data_cols\" value=\"")
- (push cols)
- (push "\">\n")))
- (push " <param name=\"data\" value=\"")
- (let loop ((col 0))
- (for-each
- (lambda (row)
- (push (ensure-numeric (list-ref-safe row col)))
- (push " "))
- data)
- (if (< col (- cols 1))
- (loop (+ 1 col))))
- (push "\">\n")))
- (if (and (string? x-label) (> (string-length x-label) 0))
- (begin
- (push " <param name=\"x_axis_label\" value=\"")
- (push x-label)
- (push "\">\n")))
- (if (and (string? y-label) (> (string-length y-label) 0))
- (begin
- (push " <param name=\"y_axis_label\" value=\"")
- (push y-label)
- (push "\">\n")))
- (if (and (string? col-colors) (> (string-length col-colors) 0))
- (begin
- (push " <param name=\"col_colors\" value=\"")
- (push col-colors)
- (push "\">\n")))
- (if (and (string? row-labels) (> (string-length row-labels) 0))
- (begin
- (push " <param name=\"row_labels\" value=\"")
- (push row-labels)
- (push "\">\n")))
- (if (and (string? col-labels) (> (string-length col-labels) 0))
- (begin
- (push " <param name=\"col_labels\" value=\"")
- (push col-labels)
- (push "\">\n")))
- (push " <param name=\"rotate_row_labels\" value=\"")
- (push (if (gnc:html-linechart-row-labels-rotated? linechart)
- "1\">\n"
- "0\">\n"))
- (push " <param name=\"stacked\" value=\"")
- (push (if (gnc:html-linechart-stacked? linechart)
- "1\">\n"
- "0\">\n"))
- (push " <param name=\"markers\" value=\"")
- (push (if (gnc:html-linechart-markers? linechart)
- "1\">\n"
- "0\">\n"))
- (push " <param name=\"major_grid\" value=\"")
- (push (if (gnc:html-linechart-major-grid? linechart)
- "1\">\n"
- "0\">\n"))
- (push " <param name=\"minor_grid\" value=\"")
- (push (if (gnc:html-linechart-minor-grid? linechart)
- "1\">\n"
- "0\">\n"))
- (push " <param name=\"legend_reversed\" value=\"")
- (push (if (gnc:html-linechart-legend-reversed? linechart)
- "1\">\n"
- "0\">\n"))
- (push "Unable to push line chart\n")
- (push "</object> \n"))
- (begin
- (gnc:warn "linechart has no non-zero data.")
- " "))
- retval))
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-;; html-linechart.scm : generate HTML programmatically, with support
;; for simple style elements.
;; Copyright 2008 Sven Henkel <shenkel at gmail.com>
;;
@@ -524,7 +47,8 @@
button-3-line-urls
button-1-legend-urls
button-2-legend-urls
- button-3-legend-urls)))
+ button-3-legend-urls
+ line-width)))
(define gnc:html-linechart?
(record-predicate <html-linechart>))
@@ -539,8 +63,8 @@
(define (gnc:make-html-linechart)
(gnc:make-html-linechart-internal -1 -1 #f #f #f #f '() '() '()
- #f #f #f #f #f #f '()
- #f #f #f #f #f #f))
+ #f #f #f #f #f #f '()
+ #f #f #f #f #f #f -1 ))
(define gnc:html-linechart-data
(record-accessor <html-linechart> 'data))
@@ -620,6 +144,7 @@
(define gnc:html-linechart-set-col-colors!
(record-modifier <html-linechart> 'col-colors))
+
(define gnc:html-linechart-legend-reversed?
(record-accessor <html-linechart> 'legend-reversed?))
@@ -678,6 +203,12 @@
(define gnc:html-linechart-set-button-3-legend-urls!
(record-modifier <html-linechart> 'button-3-legend-urls))
+(define gnc:html-linechart-line-width
+ (record-accessor <html-linechart> 'line-width))
+
+(define gnc:html-linechart-set-line-width!
+ (record-modifier <html-linechart> 'line-width))
+
(define (gnc:html-linechart-append-row! linechart newrow)
(let ((dd (gnc:html-linechart-data linechart)))
(set! dd (append dd (list newrow)))
@@ -735,11 +266,11 @@
(begin
(gnc:debug "list" list)
(if (null? list) #f
- (or (car list) (myor (cdr list))))))
+ (or (car list) (myor (cdr list))))))
(cond ((number? data) (not (= 0 data)))
- ((list? data) (myor (map gnc:not-all-zeros data)))
- (else #f)))
+ ((list? data) (myor (map gnc:not-all-zeros data)))
+ (else #f)))
(define (gnc:html-linechart-prepend-column! linechart newcol)
(let ((rows (gnc:html-linechart-data linechart))
@@ -822,16 +353,17 @@
(x-label (gnc:html-linechart-x-axis-label linechart))
(y-label (gnc:html-linechart-y-axis-label linechart))
(data (gnc:html-linechart-data linechart))
- (dummy1 (gnc:debug "data " data))
+ (dummy1 (gnc:debug "data " data))
(row-labels (catenate-escaped-strings
(gnc:html-linechart-row-labels linechart)))
(col-labels (catenate-escaped-strings
(gnc:html-linechart-col-labels linechart)))
(col-colors (catenate-escaped-strings
- (gnc:html-linechart-col-colors linechart))))
+ (gnc:html-linechart-col-colors linechart)))
+ (line-width (gnc:html-linechart-line-width linechart)))
(if (and (list? data)
(not (null? data))
- (gnc:not-all-zeros data))
+ (gnc:not-all-zeros data))
(begin
(push "<object classid=\"")(push GNC-CHART-LINE)(push "\" width=")
(push (gnc:html-linechart-width linechart))
@@ -922,33 +454,41 @@
(push " <param name=\"col_labels\" value=\"")
(push col-labels)
(push "\">\n")))
- (push " <param name=\"rotate_row_labels\" value=\"")
- (push (if (gnc:html-linechart-row-labels-rotated? linechart)
- "1\">\n"
- "0\">\n"))
- (push " <param name=\"stacked\" value=\"")
- (push (if (gnc:html-linechart-stacked? linechart)
- "1\">\n"
- "0\">\n"))
+
+
+
+ (push " <param name=\"rotate_row_labels\" value=\"")
+ (push (if (gnc:html-linechart-row-labels-rotated? linechart)
+ "1\">\n"
+ "0\">\n"))
+ (push " <param name=\"stacked\" value=\"")
+ (push (if (gnc:html-linechart-stacked? linechart)
+ "1\">\n"
+ "0\">\n"))
(push " <param name=\"markers\" value=\"")
- (push (if (gnc:html-linechart-markers? linechart)
- "1\">\n"
- "0\">\n"))
+ (push (if (gnc:html-linechart-markers? linechart)
+ "1\">\n"
+ "0\">\n"))
(push " <param name=\"major_grid\" value=\"")
- (push (if (gnc:html-linechart-major-grid? linechart)
- "1\">\n"
- "0\">\n"))
+ (push (if (gnc:html-linechart-major-grid? linechart)
+ "1\">\n"
+ "0\">\n"))
(push " <param name=\"minor_grid\" value=\"")
- (push (if (gnc:html-linechart-minor-grid? linechart)
- "1\">\n"
- "0\">\n"))
- (push " <param name=\"legend_reversed\" value=\"")
- (push (if (gnc:html-linechart-legend-reversed? linechart)
- "1\">\n"
- "0\">\n"))
+ (push (if (gnc:html-linechart-minor-grid? linechart)
+ "1\">\n"
+ "0\">\n"))
+ (push " <param name=\"legend_reversed\" value=\"")
+
+ (push (if (gnc:html-linechart-legend-reversed? linechart)
+ "1\">\n"
+ "0\">\n"))
+ (begin
+ (push " <param name=\"line_width\" value=\"")
+ (push line-width)
+ (push "\">\n"))
(push "Unable to push line chart\n")
(push "</object> \n"))
(begin
- (gnc:warn "linechart has no non-zero data.")
- " "))
+ (gnc:warn "linechart has no non-zero data.")
+ " "))
retval))
Modified: gnucash/branches/2.4/src/report/report-system/report-system.scm
===================================================================
--- gnucash/branches/2.4/src/report/report-system/report-system.scm 2012-06-16 11:52:51 UTC (rev 22222)
+++ gnucash/branches/2.4/src/report/report-system/report-system.scm 2012-06-16 13:30:21 UTC (rev 22223)
@@ -1,8 +1,8 @@
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; report-system.scm
-;; module definition for the report system code
+;; module definition for the report system code
;;
-;; Copyright (c) 2001 Linux Developers Group, Inc.
+;; Copyright (c) 2001 Linux Developers Group, Inc.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(define-module (gnucash report report-system))
@@ -51,7 +51,7 @@
(export gnc:sum-collector-stocks)
(export gnc-commodity-collector-contains-commodity?)
-;; options-utilities.scm
+;; options-utilities.scm
(export gnc:options-add-report-date!)
(export gnc:options-add-date-interval!)
@@ -73,7 +73,7 @@
(export register-font-options)
(export add-css-information-to-doc)
-;; html-utilities.scm
+;; html-utilities.scm
(export gnc:html-make-empty-cell)
(export gnc:html-make-empty-cells)
@@ -383,10 +383,10 @@
(export gnc:html-linechart-append-column!)
(export gnc:html-linechart-prepend-column!)
(export gnc:html-linechart-render linechart)
+(export gnc:html-linechart-set-line-width!)
+(export gnc:html-linechart-line-width)
+;; html-style-info.scm
-
-;; html-style-info.scm
-
(export make-kvtable)
(export kvt-ref)
(export kvt-set!)
@@ -483,7 +483,7 @@
(export gnc:html-style-sheet-find)
(export gnc:html-style-sheet-remove)
-;; html-acct-table.scm
+;; html-acct-table.scm
(export gnc:colspans-are-working-right)
(export <html-acct-table>)
@@ -520,7 +520,7 @@
(export gnc-commodity-table)
(export gnc:uniform-commodity?)
-;; html-table.scm
+;; html-table.scm
(export <html-table>)
(export gnc:html-table?)
@@ -627,7 +627,7 @@
(export gnc:html-text-render)
(export gnc:html-text-render-markup)
-;; report-utilities.scm
+;; report-utilities.scm
(export list-ref-safe)
(export list-set-safe!)
Modified: gnucash/branches/2.4/src/report/standard-reports/net-linechart.scm
===================================================================
--- gnucash/branches/2.4/src/report/standard-reports/net-linechart.scm 2012-06-16 11:52:51 UTC (rev 22222)
+++ gnucash/branches/2.4/src/report/standard-reports/net-linechart.scm 2012-06-16 13:30:21 UTC (rev 22223)
@@ -1,21 +1,21 @@
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-;; net-linechart.scm : Display a time series line chart for
+;; net-linechart.scm : Display a time series line chart for
;; either net worth or net profit.
;;
;; By Robert Merkel <rgmerk at mira.net>
;; and Christian Stimming <stimming at tu-harburg.de>
;; and Mike Evans <mikee at saxicooa.co.uk>
;;
-;; This program is free software; you can redistribute it and/or
-;; modify it under the terms of the GNU General Public License as
-;; published by the Free Software Foundation; either version 2 of
-;; the License, or (at your option) any later version.
-;;
-;; This program is distributed in the hope that it will be useful,
-;; but WITHOUT ANY WARRANTY; without even the implied warranty of
-;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-;; GNU General Public License for more details.
-;;
+;; This program is free software; you can redistribute it and/or
+;; modify it under the terms of the GNU General Public License as
+;; published by the Free Software Foundation; either version 2 of
+;; the License, or (at your option) any later version.
+;;
+;; This program is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+;; GNU General Public License for more details.
+;;
;; You should have received a copy of the GNU General Public License
;; along with this program; if not, contact:
;;
@@ -54,11 +54,21 @@
(define optname-plot-width (N_ "Plot Width"))
(define optname-plot-height (N_ "Plot Height"))
+(define optname-line-width (N_ "Line Width"))
+(define opthelp-line-width (N_ "Set line width in pixels"))
+
+(define optname-markers (N_ "Data markers?"))
+
+;;(define optname-x-grid (N_ "X grid"))
+(define optname-y-grid (N_ "Y Grid"))
+
+
+
(define (options-generator inc-exp?)
- (let* ((options (gnc:new-options))
+ (let* ((options (gnc:new-options))
;; This is just a helper function for making options.
;; See gnucash/src/scm/options.scm for details.
- (add-option
+ (add-option
(lambda (new-option)
(gnc:register-option options new-option))))
@@ -67,13 +77,13 @@
options gnc:pagename-general
optname-from-date optname-to-date "a")
- (gnc:options-add-interval-choice!
+ (gnc:options-add-interval-choice!
options gnc:pagename-general optname-stepsize "b" 'MonthDelta)
- (gnc:options-add-currency!
+ (gnc:options-add-currency!
options gnc:pagename-general optname-report-currency "c")
-
- (gnc:options-add-price-source!
+
+ (gnc:options-add-price-source!
options gnc:pagename-general
optname-price-source "d" 'weighted-average)
@@ -91,7 +101,7 @@
(gnc-account-get-descendants-sorted (gnc-get-current-root-account))))
(lambda (accounts)
(list #t
- (filter
+ (filter
(if inc-exp?
gnc:account-is-inc-exp?
(lambda (account)
@@ -102,22 +112,22 @@
;; Display tab
(add-option
(gnc:make-simple-boolean-option
- gnc:pagename-display
+ gnc:pagename-display
(if inc-exp? optname-inc-exp optname-sep-bars)
- "a"
- (if inc-exp?
+ "a"
+ (if inc-exp?
(N_ "Show Income and Expenses?")
(N_ "Show the Asset and the Liability bars?"))
#t))
(add-option
(gnc:make-simple-boolean-option
- gnc:pagename-display
+ gnc:pagename-display
(if inc-exp? optname-show-profit optname-net-bars)
- "b"
+ "b"
(if inc-exp?
(N_ "Show the net profit?")
- (N_ "Show a Net Worth bar?"))
+ (N_ "Show a Net Worth bar?"))
#t))
(add-option
@@ -127,10 +137,36 @@
"c" (N_ "Display a table of the selected data.")
#f))
- (gnc:options-add-plot-size!
- options gnc:pagename-display
+ (gnc:options-add-plot-size!
+ options gnc:pagename-display
optname-plot-width optname-plot-height "d" 800 450)
+
+ (add-option
+ (gnc:make-number-range-option
+ gnc:pagename-display optname-line-width
+ "e" opthelp-line-width
+ 0 0 5 0 1 ))
+
+
+ (add-option
+ (gnc:make-simple-boolean-option
+ gnc:pagename-display optname-y-grid
+ "f" (N_ "Add horizontal grid lines.")
+ #f))
+
+ ;(add-option
+ ; (gnc:make-simple-boolean-option
+ ; gnc:pagename-display optname-x-grid
+ ; "g" (N_ "Add vertical grid lines.")
+ ; #f))
+
+ (add-option
+ (gnc:make-simple-boolean-option
+ gnc:pagename-display optname-markers
+ "g" (N_ "Display a mark for each data point.")
+ #f))
+
(gnc:options-set-default-section options gnc:pagename-general)
options))
@@ -145,17 +181,17 @@
;; This is a helper function for looking up option values.
(define (get-option section name)
- (gnc:option-value
+ (gnc:option-value
(gnc:lookup-option (gnc:report-options report-obj) section name)))
(gnc:report-starting reportname)
- (let* ((to-date-tp (gnc:timepair-end-day-time
+ (let* ((to-date-tp (gnc:timepair-end-day-time
(gnc:date-option-absolute-time
- (get-option gnc:pagename-general
+ (get-option gnc:pagename-general
optname-to-date))))
- (from-date-tp (gnc:timepair-start-day-time
+ (from-date-tp (gnc:timepair-start-day-time
(gnc:date-option-absolute-time
- (get-option gnc:pagename-general
+ (get-option gnc:pagename-general
optname-from-date))))
(interval (get-option gnc:pagename-general optname-stepsize))
(report-currency (get-option gnc:pagename-general
@@ -165,25 +201,30 @@
(accounts (get-option gnc:pagename-accounts optname-accounts))
- (show-sep? (get-option gnc:pagename-display
- (if inc-exp? optname-inc-exp
+ (show-sep? (get-option gnc:pagename-display
+ (if inc-exp? optname-inc-exp
optname-sep-bars)))
- (show-net? (get-option gnc:pagename-display
+ (show-net? (get-option gnc:pagename-display
(if inc-exp? optname-show-profit
optname-net-bars)))
(height (get-option gnc:pagename-display optname-plot-height))
(width (get-option gnc:pagename-display optname-plot-width))
+ (markers (get-option gnc:pagename-display optname-markers))
+ (line-width (get-option gnc:pagename-display optname-line-width))
+ (y-grid (get-option gnc:pagename-display optname-y-grid))
+ ;(x-grid (get-option gnc:pagename-display optname-x-grid))
+
(commodity-list #f)
(exchange-fn #f)
(dates-list ((if inc-exp? gnc:make-date-interval-list
gnc:make-date-list)
- ((if inc-exp? gnc:timepair-start-day-time
- gnc:timepair-end-day-time) from-date-tp)
+ ((if inc-exp? gnc:timepair-start-day-time
+ gnc:timepair-end-day-time) from-date-tp)
(gnc:timepair-end-day-time to-date-tp)
(gnc:deltasym-to-delta interval)))
- (report-title (get-option gnc:pagename-general
+ (report-title (get-option gnc:pagename-general
gnc:optname-reportname))
(classified-accounts (gnc:decompose-accountlist accounts))
(show-table? (get-option gnc:pagename-display (N_ "Show table")))
@@ -203,8 +244,8 @@
(define (collector->double c date)
(gnc-numeric-to-double
(gnc:gnc-monetary-amount
- (gnc:sum-collector-commodity
- c report-currency
+ (gnc:sum-collector-commodity
+ c report-currency
(lambda (a b) (exchange-fn a b date))))))
;; This calculates the balances for all the 'accounts' for each
@@ -213,7 +254,7 @@
;; settings. Uses the collector->double conversion function
;; above. Returns a list of doubles.
(define (process-datelist accounts dates income?)
- (map
+ (map
(lambda (date)
(collector->double
((if inc-exp?
@@ -221,37 +262,37 @@
gnc:accounts-get-comm-total-income
gnc:accounts-get-comm-total-expense)
gnc:accounts-get-comm-total-assets)
- accounts
+ accounts
(lambda (account)
(if inc-exp?
;; for inc-exp, 'date' is a pair of time values, else
;; it is a time value.
- (gnc:account-get-comm-balance-interval
+ (gnc:account-get-comm-balance-interval
account (first date) (second date) #f)
- (gnc:account-get-comm-balance-at-date
+ (gnc:account-get-comm-balance-at-date
account date #f))))
(if inc-exp? (second date) date)))
dates))
(gnc:report-percent-done 1)
- (set! commodity-list (gnc:accounts-get-commodities
- (append
+ (set! commodity-list (gnc:accounts-get-commodities
+ (append
(gnc:acccounts-get-all-subaccounts accounts)
accounts)
report-currency))
(gnc:report-percent-done 10)
- (set! exchange-fn (gnc:case-exchange-time-fn
- price-source report-currency
+ (set! exchange-fn (gnc:case-exchange-time-fn
+ price-source report-currency
commodity-list to-date-tp
10 40))
(gnc:report-percent-done 50)
- (if
+ (if
(not (null? accounts))
(let* ((assets-list #f)
(liability-list #f)
(net-list #f)
- (date-string-list (map
+ (date-string-list (map
(if inc-exp?
(lambda (date-list-item)
(gnc-print-date
@@ -261,7 +302,7 @@
(set! assets-list
(process-datelist
- (if inc-exp?
+ (if inc-exp?
accounts
(assoc-ref classified-accounts ACCT-TYPE-ASSET))
dates-list #t))
@@ -276,8 +317,8 @@
(set! net-list
(map + assets-list liability-list))
(gnc:report-percent-done 90)
-
- (gnc:html-linechart-set-title!
+
+ (gnc:html-linechart-set-title!
chart report-title)
(gnc:html-linechart-set-subtitle!
chart (sprintf #f
@@ -287,15 +328,16 @@
(gnc:html-linechart-set-width! chart width)
(gnc:html-linechart-set-height! chart height)
(gnc:html-linechart-set-row-labels! chart date-string-list)
+ (gnc:html-linechart-set-major-grid?! chart y-grid)
(gnc:html-linechart-set-y-axis-label!
chart (gnc-commodity-get-mnemonic report-currency))
;; Determine whether we have enough space for horizontal labels
;; -- kind of a hack. Assumptions: y-axis labels and legend
;; require 200 pixels, and each x-axes label needs 60 pixels.
- (gnc:html-linechart-set-row-labels-rotated?!
- chart (< (/ (- width 200)
+ (gnc:html-linechart-set-row-labels-rotated?!
+ chart (< (/ (- width 200)
(length date-string-list)) 60))
-
+
;; Add the data
(if show-sep?
(begin
@@ -308,7 +350,7 @@
(add-column! net-list))
;; Legend labels, colors
- (gnc:html-linechart-set-col-labels!
+ (gnc:html-linechart-set-col-labels!
chart (append
(if show-sep?
(if inc-exp?
@@ -320,13 +362,19 @@
(list (_ "Net Profit"))
(list (_ "Net Worth")))
'())))
- (gnc:html-linechart-set-col-colors!
+ (gnc:html-linechart-set-col-colors!
chart (append
(if show-sep?
'("blue" "red") '())
(if show-net?
'("green") '())))
-
+
+ ;; Set the line width and markers
+ (gnc:html-linechart-set-line-width!
+ chart line-width)
+ (gnc:html-linechart-set-markers?!
+ chart markers)
+
;; URLs for income/expense or asset/liabilities bars.
(if show-sep?
(let ((urls
@@ -336,7 +384,7 @@
"Income Over Time"
"Assets Over Time")
report-obj
- (list
+ (list
(list gnc:pagename-display
"Use Stacked Lines" #t)
(list gnc:pagename-general
@@ -349,23 +397,23 @@
"Expense Over Time"
"Liabilities Over Time")
report-obj
- (list
+ (list
(list gnc:pagename-display
- "Use Stacked Bars" #t)
+ "Use Stacked Lines" #t)
(list gnc:pagename-general
gnc:optname-reportname
(if inc-exp?
(_ "Expense Chart")
(_ "Liability Chart"))))))))
- (gnc:html-linechart-set-button-1-line-urls!
+ (gnc:html-linechart-set-button-1-line-urls!
chart urls)
- (gnc:html-linechart-set-button-1-legend-urls!
+ (gnc:html-linechart-set-button-1-legend-urls!
chart urls)))
-
+
;; Test for all-zero data here.
(if non-zeros
(begin
- (gnc:html-document-add-object! document chart)
+ (gnc:html-document-add-object! document chart)
(if show-table?
(let ((table (gnc:make-html-table)))
(gnc:html-table-set-style!
@@ -412,13 +460,13 @@
document
(gnc:html-make-empty-data-warning
report-title (gnc:report-id report-obj)))))
-
+
;; else no accounts selected
(gnc:html-document-add-object!
document
- (gnc:html-make-no-account-warning
+ (gnc:html-make-no-account-warning
report-title (gnc:report-id report-obj))))
-
+
(gnc:report-finished)
document))
More information about the gnucash-changes
mailing list