r22935 - gnucash/trunk/src/report/report-system - Fix chart positioning on multi-column report
Geert Janssens
gjanssens at code.gnucash.org
Thu May 2 10:43:09 EDT 2013
Author: gjanssens
Date: 2013-05-02 10:43:09 -0400 (Thu, 02 May 2013)
New Revision: 22935
Trac: http://svn.gnucash.org/trac/changeset/22935
Modified:
gnucash/trunk/src/report/report-system/html-barchart.scm
gnucash/trunk/src/report/report-system/html-linechart.scm
gnucash/trunk/src/report/report-system/html-piechart.scm
gnucash/trunk/src/report/report-system/html-scatter.scm
Log:
Fix chart positioning on multi-column report
This is a follow-up on bug #638971
Modified: gnucash/trunk/src/report/report-system/html-barchart.scm
===================================================================
--- gnucash/trunk/src/report/report-system/html-barchart.scm 2013-05-02 14:42:48 UTC (rev 22934)
+++ gnucash/trunk/src/report/report-system/html-barchart.scm 2013-05-02 14:43:09 UTC (rev 22935)
@@ -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)
Modified: gnucash/trunk/src/report/report-system/html-linechart.scm
===================================================================
--- gnucash/trunk/src/report/report-system/html-linechart.scm 2013-05-02 14:42:48 UTC (rev 22934)
+++ gnucash/trunk/src/report/report-system/html-linechart.scm 2013-05-02 14:43:09 UTC (rev 22935)
@@ -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)
Modified: gnucash/trunk/src/report/report-system/html-piechart.scm
===================================================================
--- gnucash/trunk/src/report/report-system/html-piechart.scm 2013-05-02 14:42:48 UTC (rev 22934)
+++ gnucash/trunk/src/report/report-system/html-piechart.scm 2013-05-02 14:43:09 UTC (rev 22935)
@@ -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")
" "))
Modified: gnucash/trunk/src/report/report-system/html-scatter.scm
===================================================================
--- gnucash/trunk/src/report/report-system/html-scatter.scm 2013-05-02 14:42:48 UTC (rev 22934)
+++ gnucash/trunk/src/report/report-system/html-scatter.scm 2013-05-02 14:43:09 UTC (rev 22935)
@@ -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
More information about the gnucash-changes
mailing list