Fix #5648 - New design for post release report
authorEdward <edward@roojs.com>
Tue, 19 Feb 2019 10:18:39 +0000 (18:18 +0800)
committerEdward <edward@roojs.com>
Tue, 19 Feb 2019 10:18:39 +0000 (18:18 +0800)
g.bar.overlay.js

index 4e1f590..6ae0cfc 100644 (file)
@@ -69,8 +69,8 @@ if (typeof(Raphael) == 'undefined') {
             bars = paper.set(),
             covers = paper.set(),
             barsteps = opts.barsteps || 20,
-            colors = opts.colors || chartinst.colors,
-            max = 3000;
+            colors = opts.colors || chartinst.colors;
+            
         
         opts.axis = opts.axis || "";
         opts.baroffset = opts.baroffset || 50;
@@ -93,6 +93,19 @@ if (typeof(Raphael) == 'undefined') {
         
         paper.path(path).attr({ stroke: "#fff", "stroke-width": 2 });
         
+        var max = 0;
+        
+        values.forEach(function(value,i) {
+            if (!Raphael.is(values[0], "array")) {
+                value = [value];
+            }
+    
+            value.forEach(function(v,k)  {
+                max = (v > max) ? v : max;
+            });
+            
+        });
+        
         //bars
         var unit = barheight / max;
         var indicator = [];
@@ -123,8 +136,8 @@ if (typeof(Raphael) == 'undefined') {
         // right axis
         +ax[1] && axis.push(
             chartinst.rightAxis(
-                x + width - opts.asixywidth ,
-                y + height - opts.asixxheight,
+                width - opts.asixywidth,
+                height - opts.asixxheight,
                 height - y - opts.asixxheight,
                 max,
                 opts.axisystep || 10,