r22800 - gnucash/trunk/src/report/report-system - Charts: source formatting

Geert Janssens gjanssens at code.gnucash.org
Thu Feb 21 11:51:31 EST 2013


Author: gjanssens
Date: 2013-02-21 11:51:31 -0500 (Thu, 21 Feb 2013)
New Revision: 22800
Trac: http://svn.gnucash.org/trac/changeset/22800

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:
Charts: source formatting

- fix some whitespace
- improveformatting of resulting html

Modified: gnucash/trunk/src/report/report-system/html-barchart.scm
===================================================================
--- gnucash/trunk/src/report/report-system/html-barchart.scm	2013-02-21 16:51:20 UTC (rev 22799)
+++ gnucash/trunk/src/report/report-system/html-barchart.scm	2013-02-21 16:51:31 UTC (rev 22800)
@@ -340,7 +340,7 @@
          (series-data-start (lambda (series-index)
                          (push "var d")
                          (push series-index)
-                         (push " = [];")))
+                         (push " = [];\n")))
          (series-data-add (lambda (series-index x y)
                          (push (string-append
                                "  d"
@@ -351,13 +351,12 @@
                                (number->string y)
                                "]);\n"))))
          (series-data-end (lambda (series-index label)
-                         (push "  series.push({")
-                         (push "    label: \"")
-                         (push label)
-                         (push "\"});\n")
                          (push "data.push(d")
                          (push series-index)
-                         (push ");\n"))))
+                         (push ");\n")
+                         (push "series.push({ label: \"")
+                         (push label)
+                         (push "\"});\n\n"))))
     (if (and (list? data)
              (not (null? data))
              (gnc:not-all-zeros data))
@@ -374,11 +373,11 @@
             (push (gnc:html-barchart-width barchart))
             (push "px;height:")
             (push (gnc:html-barchart-height barchart))
-            (push "px;\"></div>")
+            (push "px;\"></div>\n")
             (push "<script id=\"source\">\n$(function () {")
 
             (push "var data = [];")
-            (push "var series = [];")
+            (push "var series = [];\n")
 
             (if (and data (list? data))
               (let ((rows (length data))
@@ -416,34 +415,24 @@
                    series: series,
                    axesDefaults: {
                    },        
-                    grid: {
-                        hoverable: true,
-                        markings: function(axes) {
-                            var markings = [];
-                            for (var x = Math.floor(axes.xaxis.min); x < axes.xaxis.max; x += 2)
-                                markings.push({ xaxis: { from: x - 0.5, to: x + 0.5 } })
-                            return markings;
-                        }
-                    },
-                    axes: {
-                        xaxis: {
-                            renderer: $.jqplot.CategoryAxisRenderer,
-                            tickRenderer: $.jqplot.CanvasAxisTickRenderer,
-                            tickOptions: {
-                                angle: -30,
-                                fontSize: '10pt',
-                            },
-                        },
-                        yaxis: {
-                            autoscale: true,
-                        },
-                    },
-                    xaxis: {
-                        tickLength: 0
-                    }
-                };")
+                   grid: {
+                   },
+                   axes: {
+                       xaxis: {
+                           renderer: $.jqplot.CategoryAxisRenderer,
+                           tickRenderer: $.jqplot.CanvasAxisTickRenderer,
+                           tickOptions: {
+                               angle: -30,
+                               fontSize: '10pt',
+                           },
+                       },
+                       yaxis: {
+                           autoscale: true,
+                       },
+                   }
+                };\n")
 
-            (push "options.stackSeries = ")
+            (push "  options.stackSeries = ")
             (push (if (gnc:html-barchart-stacked? barchart)
                 "true;\n"
                 "false;\n"))
@@ -512,7 +501,7 @@
 
                             var offsetX = 0;//(plot.getAxes().xaxis.scale * item.series.bars.barWidth);
                             showTooltip(evt.pageX + offsetX, evt.pageY,
-                                        options.series[seriesIndex].label + \" of \" + x + \"<br><b>$\" + y + \"</b>\");
+                                        options.series[seriesIndex].label + \" of \" + x + \"<br><b>\" + y + \"</b>\");
                             // <small>(+100.00)</small>
                         }
                     } else {
@@ -526,7 +515,7 @@
 
             ") 
 
-            (push "});</script>")
+            (push "});\n</script>")
 
             (gnc:msg (string-join (reverse (map (lambda (e) (if (number? e) (number->string e) e)) retval)) ""))
  

Modified: gnucash/trunk/src/report/report-system/html-linechart.scm
===================================================================
--- gnucash/trunk/src/report/report-system/html-linechart.scm	2013-02-21 16:51:20 UTC (rev 22799)
+++ gnucash/trunk/src/report/report-system/html-linechart.scm	2013-02-21 16:51:31 UTC (rev 22800)
@@ -403,11 +403,11 @@
             (push (gnc:html-linechart-width linechart))
             (push "px;height:")
             (push (gnc:html-linechart-height linechart))
-            (push "px;\"></div>")
+            (push "px;\"></div>\n")
             (push "<script id=\"source\">\n$(function () {")
 
             (push "var data = [];")
-            (push "var series = [];")
+            (push "var series = [];\n")
 
             (if (and data (list? data))
               (let ((rows (length data))
@@ -539,7 +539,7 @@
 
             ") 
 
-            (push "});</script>")
+            (push "});\n</script>")
 
             (gnc:msg (string-join (reverse (map (lambda (e) (if (number? e) (number->string e) e)) retval)) ""))
             

Modified: gnucash/trunk/src/report/report-system/html-piechart.scm
===================================================================
--- gnucash/trunk/src/report/report-system/html-piechart.scm	2013-02-21 16:51:20 UTC (rev 22799)
+++ gnucash/trunk/src/report/report-system/html-piechart.scm	2013-02-21 16:51:31 UTC (rev 22800)
@@ -216,10 +216,10 @@
             (push (gnc:html-piechart-width piechart))
             (push "px;height:")
             (push (gnc:html-piechart-height piechart))
-            (push "px;\"></div>")
+            (push "px;\"></div>\n")
             (push "<script id=\"source\">\n$(function () {")
 
-            (push "var data = [];")
+            (push "var data = [];\n")
 
             (if (and data (list? data))
               (begin 
@@ -239,7 +239,7 @@
                     legend: {
                          show: true,
                          placement: \"outsideGrid\", },
-                   };")
+                   };\n")
 
             (if title
               (begin 
@@ -252,17 +252,7 @@
 
             (push "$.jqplot.config.enablePlugins = true;")
             (push "var plot = $.jqplot('placeholder', [data], options);")
-            (push "});</script>"))
+            (push "});\n</script>"))
         (begin (gnc:warn "null-data, not rendering piechart")
                " "))
     retval))
-
-
-
-
-
-
-
-
-
-

Modified: gnucash/trunk/src/report/report-system/html-scatter.scm
===================================================================
--- gnucash/trunk/src/report/report-system/html-scatter.scm	2013-02-21 16:51:20 UTC (rev 22799)
+++ gnucash/trunk/src/report/report-system/html-scatter.scm	2013-02-21 16:51:31 UTC (rev 22800)
@@ -156,11 +156,11 @@
             (push (gnc:html-scatter-width scatter))
             (push "px;height:")
             (push (gnc:html-scatter-height scatter))
-            (push "px;\"></div>")
+            (push "px;\"></div>\n")
             (push "<script id=\"source\">\n$(function () {")
 
             (push "var data = [];")
-            (push "var series = [];")
+            (push "var series = [];\n")
 
             (if (and data (list? data))
               (let ((x-data (map-in-order car data))
@@ -170,7 +170,7 @@
                          (push (ensure-numeric x))
                          (push ", ")
                          (push (ensure-numeric y))
-                         (push "]);"))
+                         (push "]);\n"))
                        x-data y-data)
             ))
 
@@ -223,7 +223,7 @@
             (push "$.jqplot.config.enablePlugins = true;")
             (push "var plot = $.jqplot('placeholder', [data], options);")
 
-            (push "});</script>"))
+            (push "});\n</script>"))
         (begin
           (gnc:warn "Scatter chart has no non-zero data")
             " "))



More information about the gnucash-changes mailing list