Fix chart positioning on multi-column report

This is a follow-up on bug #638971

git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@22935 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
Geert Janssens 2013-05-02 14:43:09 +00:00
parent 24ad9c3fc4
commit 216bb3263c
4 changed files with 24 additions and 12 deletions

View File

@ -356,7 +356,10 @@
(push ");\n")
(push "series.push({ label: \"")
(push label)
(push "\"});\n\n"))))
(push "\"});\n\n")))
; Use a unique chart-id for each chart. This prevents chart
; clashed on multi-column reports
(chart-id (string-append "chart-" (number->string (random 999999)))))
(if (and (list? data)
(not (null? data))
(gnc:not-all-zeros data))
@ -370,7 +373,7 @@
(push (gnc:html-js-include "jqplot/jqplot.canvasAxisTickRenderer.js"))
(push (gnc:html-css-include "jqplot/jquery.jqplot.css"))
(push "<div id=\"placeholder\" style=\"width:")
(push "<div id=\"")(push chart-id)(push "\" style=\"width:")
(push (gnc:html-barchart-width barchart))
(push "px;height:")
(push (gnc:html-barchart-height barchart))
@ -473,7 +476,7 @@
(push "$.jqplot.config.enablePlugins = true;")
(push "var plot = $.jqplot('placeholder', data, options);
(push "var plot = $.jqplot('")(push chart-id)(push"', data, options);
function formatTooltip(str, seriesIndex, pointIndex) {
if (options.axes.xaxis.ticks[pointIndex] !== undefined)

View File

@ -388,7 +388,10 @@
(push ");\n")
(push "series.push({ label: \"")
(push label)
(push "\"});\n\n"))))
(push "\"});\n\n")))
; Use a unique chart-id for each chart. This prevents chart
; clashed on multi-column reports
(chart-id (string-append "chart-" (number->string (random 999999)))))
(if (and (list? data)
(not (null? data))
(gnc:not-all-zeros data))
@ -400,7 +403,7 @@
(push (gnc:html-js-include "jqplot/jqplot.canvasAxisTickRenderer.js"))
(push (gnc:html-css-include "jqplot/jquery.jqplot.css"))
(push "<div id=\"placeholder\" style=\"width:")
(push "<div id=\"")(push chart-id)(push "\" style=\"width:")
(push (gnc:html-linechart-width linechart))
(push "px;height:")
(push (gnc:html-linechart-height linechart))
@ -518,7 +521,7 @@
(push "$.jqplot.config.enablePlugins = true;")
(push "var plot = $.jqplot('placeholder', data, options);
(push "var plot = $.jqplot('")(push chart-id)(push"', data, options);
function formatTooltip(str, seriesIndex, pointIndex) {
if (options.axes.xaxis.ticks[pointIndex] !== undefined)

View File

@ -203,7 +203,10 @@
(labels
(catenate-escaped-strings (gnc:html-piechart-labels piechart)))
(colors
(catenate-escaped-strings (gnc:html-piechart-colors piechart))))
(catenate-escaped-strings (gnc:html-piechart-colors piechart)))
; Use a unique chart-id for each chart. This prevents chart
; clashed on multi-column reports
(chart-id (string-append "chart-" (number->string (random 999999)))))
(if (and (list? data)
(not (null? data)))
(begin
@ -212,7 +215,7 @@
(push (gnc:html-js-include "jqplot/jqplot.pieRenderer.js"))
(push (gnc:html-css-include "jqplot/jquery.jqplot.css"))
(push "<div id=\"placeholder\" style=\"width:")
(push "<div id=\"")(push chart-id)(push "\" style=\"width:")
(push (gnc:html-piechart-width piechart))
(push "px;height:")
(push (gnc:html-piechart-height piechart))
@ -251,7 +254,7 @@
(push subtitle) (push ")\";\n")))
(push "$.jqplot.config.enablePlugins = true;\n")
(push "var plot = $.jqplot('placeholder', [data], options);\n")
(push "var plot = $.jqplot('")(push chart-id)(push "', [data], options);\n")
(push "});\n</script>"))
(begin (gnc:warn "null-data, not rendering piechart")
" "))

View File

@ -144,7 +144,10 @@
(y-label (gnc:html-scatter-y-axis-label scatter))
(data (gnc:html-scatter-data scatter))
(marker (gnc:html-scatter-marker scatter))
(markercolor (string-append "#" (gnc:html-scatter-markercolor scatter))))
(markercolor (string-append "#" (gnc:html-scatter-markercolor scatter)))
; Use a unique chart-id for each chart. This prevents chart
; clashed on multi-column reports
(chart-id (string-append "chart-" (number->string (random 999999)))))
(if (and (list? data)
(not (null? data)))
(begin
@ -152,7 +155,7 @@
(push (gnc:html-js-include "jqplot/jquery.jqplot.js"))
(push (gnc:html-css-include "jqplot/jquery.jqplot.css"))
(push "<div id=\"placeholder\" style=\"width:")
(push "<div id=\"")(push chart-id)(push "\" style=\"width:")
(push (gnc:html-scatter-width scatter))
(push "px;height:")
(push (gnc:html-scatter-height scatter))
@ -221,7 +224,7 @@
(push "$.jqplot.config.enablePlugins = true;\n")
(push "var plot = $.jqplot('placeholder', [data], options);\n")
(push "var plot = $.jqplot('")(push chart-id)(push "', [data], options);\n")
(push "});\n</script>"))
(begin