r22791 - gnucash/trunk/src/report/report-system - Improve barchart
Geert Janssens
gjanssens at code.gnucash.org
Wed Feb 20 13:51:05 EST 2013
Author: gjanssens
Date: 2013-02-20 13:51:04 -0500 (Wed, 20 Feb 2013)
New Revision: 22791
Trac: http://svn.gnucash.org/trac/changeset/22791
Modified:
gnucash/trunk/src/report/report-system/html-barchart.scm
Log:
Improve barchart
- drop goffice based chart, only keep jquery one
- move legend outside of plotting area
Modified: gnucash/trunk/src/report/report-system/html-barchart.scm
===================================================================
--- gnucash/trunk/src/report/report-system/html-barchart.scm 2013-02-20 18:50:43 UTC (rev 22790)
+++ gnucash/trunk/src/report/report-system/html-barchart.scm 2013-02-20 18:51:04 UTC (rev 22791)
@@ -142,6 +142,14 @@
;; used for all of the rows. Otherwise we could have cols*rows urls
;; (quite a lot), but this first requires fixing
;; guppi_bar_1_callback() in gnome/gnc-html-guppi.c .
+;; FIXME url's haven't been working since GnuCash 1.x
+;; GnuCash 2.x switched from guppy to goffice, which
+;; made it very hard to remain the url functionality
+;; At this point I (gjanssens) is in the process of
+;; moving from goffice to jqplot for our charts
+;; which perhaps may allow urls again in the charts
+;; I'm keeping the parameters below around to remind
+;; us this still has to be investigated again
(define gnc:html-barchart-button-1-bar-urls
(record-accessor <html-barchart> 'button-1-bar-urls))
@@ -352,7 +360,7 @@
(push ");\n"))))
(if (and (list? data)
(not (null? data))
- (gnc:not-all-zeros data))
+ (gnc:not-all-zeros data))
(begin
(push (gnc:html-js-include "jqplot/jquery.min.js"))
(push (gnc:html-js-include "jqplot/jquery.jqplot.js"))
@@ -394,7 +402,9 @@
(push "var options = {
shadowAlpha: 0.07,
stackSeries: false,
- legend: { show: true, },
+ legend: {
+ show: true,
+ placement: \"outsideGrid\", },
seriesDefaults: {
renderer: $.jqplot.BarRenderer,
rendererOptions: {
@@ -520,110 +530,8 @@
(gnc:msg (string-join (reverse (map (lambda (e) (if (number? e) (number->string e) e)) retval)) ""))
- (push "<object classid=\"")(push GNC-CHART-BAR)(push "\" width=")
- (push (gnc:html-barchart-width barchart))
- (push " height=")
- (push (gnc:html-barchart-height barchart))
- (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=\"bar_urls_1\" value=\"")
- (push url-1)
- (push "\">\n")))
- (if url-2
- (begin
- (push " <param name=\"bar_urls_2\" value=\"")
- (push url-2)
- (push "\">\n")))
- (if url-3
- (begin
- (push " <param name=\"bar_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-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> \n"))
+ )
(begin
- (gnc:warn "barchart has no non-zero data.")
- " "))
+ (gnc:warn "barchart has no non-zero data.")
+ " "))
retval))
More information about the gnucash-changes
mailing list