gnucash unstable: Multiple changes pushed

John Ralls jralls at code.gnucash.org
Tue Oct 31 20:46:53 EDT 2017


Updated	 via  https://github.com/Gnucash/gnucash/commit/4f971636 (commit)
	 via  https://github.com/Gnucash/gnucash/commit/6e3d4781 (commit)
	 via  https://github.com/Gnucash/gnucash/commit/d6d1549a (commit)
	 via  https://github.com/Gnucash/gnucash/commit/3926535e (commit)
	from  https://github.com/Gnucash/gnucash/commit/a6f4ea65 (commit)



commit 4f9716362c7c10c5c02f4b14ca0f9f2aa66c244e
Merge: a6f4ea6 6e3d478
Author: John Ralls <jralls at ceridwen.us>
Date:   Tue Oct 31 17:31:33 2017 -0700

    Merge branch J. Marino's fix-report-colors into unstable


commit 6e3d47819d6f2cefed18b70656320fc50c790962
Author: Jose Marino <jmarino at users.noreply.github.com>
Date:   Thu Oct 12 15:39:19 2017 -0600

    report: render linechart with requested line colors
    
    A report can specify the bar colors of a barchart with a call to:
       (gnc:html-linechart-set-col-colors! chart (list "blue" "red"))
    However, these colors were ignored when rendering the linechart.
    
    This patch adds the jqplot option "seriesColors" to pass
    the requested bar colors to jqplot. If no colors are requested,
    we let jqplot use default colors by setting "seriesColors: false".

diff --git a/gnucash/report/report-system/html-linechart.scm b/gnucash/report/report-system/html-linechart.scm
index ced16fc..927836f 100644
--- a/gnucash/report/report-system/html-linechart.scm
+++ b/gnucash/report/report-system/html-linechart.scm
@@ -388,8 +388,10 @@
                       (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)))
+         ;; convert color list to string with valid js array of strings, example: "\"blue\", \"red\""
+         (colors-str (string-join (map (lambda (color)
+                                         (string-append "\"" color "\""))
+                                       (gnc:html-linechart-col-colors linechart)) ", "))
          (line-width (gnc:html-linechart-line-width linechart))
          (series-data-start (lambda (series-index)
                          (push "var d")
@@ -501,7 +503,8 @@
                    cursor: {
                        show: true,
                        zoom: true
-                   }
+                   },
+                   seriesColors: false,
                 };\n")
 
             (push "  options.stackSeries = ")
@@ -546,6 +549,13 @@
                 (push "  options.axes.yaxis.label = \"")
                 (push y-label)
                 (push "\";\n")))
+	    (if (not (equal? colors-str ""))
+                (begin            ; example: options.seriesColors= ["blue", "red"];
+                  (push "options.seriesColors = [")
+                  (push colors-str)
+                  (push "];\n")
+                  )
+                )
 
             ;; adjust the date string format to the one given by the preferences
             (push "  options.axes.xaxis.tickOptions.formatString = '")

commit d6d1549a40d4c1ed0b3aeef62779db24c6c38a28
Author: Jose Marino <jmarino at users.noreply.github.com>
Date:   Thu Oct 12 15:32:58 2017 -0600

    report: render piechart with requested colors
    
    A report can specify the pie chart colors with a call to:
       (gnc:html-piechart-set-colors! chart (list "blue" "red"))
    However, these colors were ignored when rendering the piechart.
    
    This patch adds the jqplot option "seriesColors" to pass
    the requested colors to jqplot. If no colors are requested,
    we let jqplot use default colors by setting "seriesColors: false".

diff --git a/gnucash/report/report-system/html-piechart.scm b/gnucash/report/report-system/html-piechart.scm
index 0df736a..f8b74a8 100644
--- a/gnucash/report/report-system/html-piechart.scm
+++ b/gnucash/report/report-system/html-piechart.scm
@@ -200,6 +200,10 @@
            (gnc:html-piechart-button-3-legend-urls piechart)))
          (data 
           (ensure-positive-numbers (gnc:html-piechart-data piechart)))
+         ;; convert color list to string with valid js array of strings, example: "\"blue\", \"red\""
+         (colors-str (string-join (map (lambda (color)
+                                         (string-append "\"" color "\""))
+                                       (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)))))
@@ -247,6 +251,7 @@
                          show: false },
                     cursor: {
                          showTooltip: false },
+                    seriesColors: false,
                    };\n")
 
             (if title
@@ -259,6 +264,13 @@
                 (push "  options.title += \" (")
                 (push (jqplot-escape-string subtitle))
                 (push ")\";\n")))
+            (if (not (equal? colors-str ""))
+                (begin            ; example: options.seriesColors= ["blue", "red"];
+                  (push "options.seriesColors = [")
+                  (push colors-str)
+                  (push "];\n")
+                  )
+                )
 
             (push "$.jqplot.config.enablePlugins = true;\n")
             (push "$(document).ready(function() {

commit 3926535e67a1f559b67b7e4494bc41c8426387cd
Author: Jose Marino <jmarino at users.noreply.github.com>
Date:   Thu Oct 12 15:11:00 2017 -0600

    report: render barchart with requested bar colors
    
    A report can specify the bar colors of a barchart with a call to:
       (gnc:html-barchart-set-col-colors! chart (list "blue" "red"))
    However, these colors were ignored when rendering the barchart.
    
    This patch adds the jqplot option "seriesColors" to pass
    the requested bar colors to jqplot. If no colors are requested,
    we let jqplot use default colors by setting "seriesColors: false".

diff --git a/gnucash/report/report-system/html-barchart.scm b/gnucash/report/report-system/html-barchart.scm
index be937f6..f172fa1 100644
--- a/gnucash/report/report-system/html-barchart.scm
+++ b/gnucash/report/report-system/html-barchart.scm
@@ -353,8 +353,10 @@
                       (gnc:html-barchart-row-labels barchart)))
          (col-labels (catenate-escaped-strings 
                       (gnc:html-barchart-col-labels barchart)))
-         (col-colors (catenate-escaped-strings 
-                      (gnc:html-barchart-col-colors barchart)))
+         ;; convert color list to string with valid js array of strings, example: "\"blue\", \"red\""
+         (colors-str (string-join (map (lambda (color)
+					 (string-append "\"" color "\""))
+				       (gnc:html-barchart-col-colors barchart)) ", "))
          (series-data-start (lambda (series-index)
                          (push "var d")
                          (push series-index)
@@ -476,6 +478,7 @@
                        showTooltip: false,
                        zoom: true,
                    },
+                   seriesColors: false,
                 };\n")
 
             (push "  options.stackSeries = ")
@@ -506,6 +509,13 @@
                 (push y-label)
                 (push "\";\n")))
             (push "  options.axes.xaxis.ticks = all_ticks;\n")
+            (if (not (equal? colors-str ""))
+                (begin            ; example: options.seriesColors= ["blue", "red"];
+                  (push "options.seriesColors = [")
+                  (push colors-str)
+                  (push "];\n")
+                  )
+                )
 
 
             (push "$.jqplot.config.enablePlugins = true;\n")



Summary of changes:
 gnucash/report/report-system/html-barchart.scm  | 14 ++++++++++++--
 gnucash/report/report-system/html-linechart.scm | 16 +++++++++++++---
 gnucash/report/report-system/html-piechart.scm  | 12 ++++++++++++
 3 files changed, 37 insertions(+), 5 deletions(-)



More information about the gnucash-changes mailing list