Improve barchart

- drop goffice based chart, only keep jquery one
- move legend outside of plotting area

git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@22791 57a11ea4-9604-0410-9ed3-97b8803252fd
pull/1/head
Geert Janssens 13 years ago
parent e5d298e4b5
commit 9d535f045c

@ -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> &nbsp;\n"))
)
(begin
(gnc:warn "barchart has no non-zero data.")
" "))
(gnc:warn "barchart has no non-zero data.")
" "))
retval))

Loading…
Cancel
Save