fix #8056 - more refinements to checking data
[g.raphael] / g.bar.0.51.js
index 6a0a342..726c8a1 100644 (file)
@@ -4,8 +4,16 @@
  * Copyright (c) 2009-2012 Dmitry Baranovskiy (http://g.raphaeljs.com)
  * Licensed under the MIT (http://www.opensource.org/licenses/mit-license.php) license.
  */
-Raphael = typeof(Raphael) != 'undefined' ? Raphael :  (imports ? imports.seed.Raphael.Raphael : {});
-Roo = typeof(Roo) != 'undefined' ? Roo:  (imports ? imports.seed.Roo.Roo: {});
+
+if (typeof(Raphael) == 'undefined') {
+    // support for seed/simple browser usage
+    importz = imports['seed/importz.js'].importz;
+
+    Raphael = importz('Raphael');
+    Roo = importz('Roo');
+}
+
+
 //chartinst = typeof(chartinst) != 'undefined' ? chartinst:  (imports ? imports.chartinst.chartinst : {});
  
 
@@ -219,7 +227,6 @@ Roo = typeof(Roo) != 'undefined' ? Roo:  (imports ? imports.seed.Roo.Roo: {});
         }
         opts.axis = opts.axis || "";
         
-        
         var allx = Array.prototype.concat.apply([], opts.xvalues),
             ally = Array.prototype.concat.apply([], opts.yvalues),
             
@@ -331,11 +338,11 @@ Roo = typeof(Roo) != 'undefined' ? Roo:  (imports ? imports.seed.Roo.Roo: {});
 
             for (var j = 0; j < (multi || 1); j++) {
                 //Roo.log( [ 'vbar-loop', multi ? values[j][i] : values[i],  Y]);
-                
+                var color = colors[multi ? j : i%colors.length];
                 
                 var h = Math.round((multi ? values[j][i] : values[i]) * Y),
                     top = y + height - barvgutter - h,
-                    bar = finger(Math.round(X + barwidth / 2), top + h, barwidth, h, true, type, null, paper).attr({ stroke: "none", fill: colors[multi ? j : i] });
+                    bar = finger(Math.round(X + barwidth / 2), top + h, barwidth, h, true, type, null, paper).attr({ stroke: "none", fill: color });
                 //Roo.log([y , height , barvgutter ,h]);
                  
                 if (multi) {
@@ -428,7 +435,10 @@ Roo = typeof(Roo) != 'undefined' ? Roo:  (imports ? imports.seed.Roo.Roo: {});
         
         if (opts.axis) {
             var axis = paper.set();
-             
+            // Roo.log(opts.axis);
+            
+            
+            
             
             // top axis
             +ax[0] && axis.push(
@@ -478,9 +488,7 @@ Roo = typeof(Roo) != 'undefined' ? Roo:  (imports ? imports.seed.Roo.Roo: {});
                     loffset :   Math.round(barhgutter + (barwidth / 2.0)),
                     roffset :   Math.round(barhgutter + (barwidth / 2.0))
             };
-            Roo.log('ax_args');
-            Roo.log(ax_args);
-            Roo.log('end');
+            //Roo.log(ax_args);
             +ax[2] && axis.push(
                 // bottom
                 // x, y, length, from, to, steps, orientation, labels, type, dashsize, paper
@@ -504,14 +512,13 @@ Roo = typeof(Roo) != 'undefined' ? Roo:  (imports ? imports.seed.Roo.Roo: {});
                         x + gutter,
                         y + height - gutter,
                         height - 2 * gutter,
-                        0,
+                        miny,
                         maxy ,
                         opts.axisystep, 
                         
                         1,
                         paper
             ));
-                
         }