fix #8056 - more refinements to checking data
[g.raphael] / g.raphael.js
index 64179e0..b68494c 100644 (file)
@@ -745,21 +745,22 @@ Raphael.g = {
             return colors;
     })(),
     
-    snapEnds: function(from, to, steps) {
+    snapEnds: function(from, to, steps)
+    {
         var f = from,
             t = to;
 
         f= isNaN(f) ? 0 : f;
         t= isNaN(t) ? 0 : t;
             
-        if (f == t) {
+        if (f == t || steps == 0) {
             return {from: f, to: t, power: 0};
         }
+        
         if (Math.abs(f) == Infinity || Math.abs(t) == Infinity) {
             return {from: f, to: t, power: 0};
         }
         
-
         function round(a) {
             return Math.abs(a - .5) < .25 ? ~~(a) + .5 : Math.round(a);
         }
@@ -810,7 +811,7 @@ Raphael.g = {
             i = ends.power,
             j = 0,
             txtattr = { font: "11px Arial, sans-serif" },
-            text = paper.set(),
+            text =  paper.set(),
             d;
 
         d = (t - f) / steps;
@@ -833,7 +834,7 @@ Raphael.g = {
                         x + addon,
                         Y,
                         (labels && labels[j++]) || (
-                            Math.round(label) == label ? Roo.util.Format.number(label) : (+Roo.util.Format.number(rnd,0))
+                            Math.round(label) == label ? Roo.util.Format.number(label,0) : Roo.util.Format.number(label,rnd)
                         )
                     ).attr(txtattr).attr({
                         "text-anchor": orientation - 1 ? "start" : "end"
@@ -857,6 +858,7 @@ Raphael.g = {
                 txt = 0,
                 prev = 0;
 
+            //Roo.log([X,x,length, dx]); return;
             while (X <= x + length) {
                 type != "-" && type != " " && (path = path.concat(["M", X + .5, y - (type == "+" ? dashsize : !!orientation * dashsize * 2), "l", 0, dashsize * 2 + 1]));
                 text.push(txt = paper.text(X, y + addon, (labels && labels[j++]) || (Math.round(label) == label ? label : +label.toFixed(rnd))).attr(txtattr));