fix #8056 - more refinements to checking data
[g.raphael] / g.line.js
index 581cbeb..243ba8c 100644 (file)
--- a/g.line.js
+++ b/g.line.js
@@ -158,58 +158,58 @@ if (typeof(Raphael) == 'undefined') {
                         paper));
                         
             // bottom axis
-//            opts.axisxlabels = opts.axisxlabels || [];
-//            
-//            opts.axisxstep  = opts.axisxstep || (opts.axisxlabels ? opts.axisxlabels.length -1 : false ) || len;
-//            
-//            var ax_args = {
-//                    x : x +  20 ,
-//                    y: y + height - gutter,
-//                    length : X  - x, // total width
-//                    from: minx ,  // from -- infinity??? if no 'xvalues set'
-//                    to : maxx, //to
-//                    steps : opts.axisxstep , // 9 when we have 8 items?
-//                    orientation : 0, // orientation
-//                    labels : opts.axisxlabels || false, // labels
-//                    type : "-", // type ofbarhgutter line
-//                    dashsize : 5, // dash size
-//                    paper: paper,
-//                    loffset :   Math.round(gutter / 100 + (1)),
-//                    roffset :   Math.round(gutter / 100 + (1)),
-//            };
-//            //Roo.log(ax_args);
+            opts.axisxlabels = opts.axisxlabels || [];
+            
+            opts.axisxstep  = opts.axisxstep || (opts.axisxlabels ? opts.axisxlabels.length -1 : false ) || len;
+            
+            var ax_args = {
+                    x : x + gutter,
+                    y: y + height - gutter,
+                    length : width - 2 * gutter + 20, // total width
+                    from: minx ,  // from -- infinity??? if no 'xvalues set'
+                    to : maxx, //to
+                    steps : opts.axisxstep , // 9 when we have 8 items?
+                    orientation : 0, // orientation
+                    labels : opts.axisxlabels || false, // labels
+                    type : "-", // type ofbarhgutter line
+                    dashsize : 5, // dash size
+                    paper: paper,
+                    loffset :   Math.round(gutter / 100 + (1)),
+                    roffset :   Math.round(gutter / 100 + (1)) + 20,
+            };
+            //Roo.log(ax_args);
 //            +ax[2] && axis.push(
 //                // bottom
 //                // x, y, length, from, to, steps, orientation, labels, type, dashsize, paper
-//                chartinst.axis( ax_args)
-//            );
-            Roo.log(maxx);
-            +ax[2] && axis.push(
-                // bottom
-                // x, y, length, from, to, steps, orientation, labels, type, dashsize, paper
-                chartinst.axis(
-                    x + gutter,
-                    y + height - gutter,
-                    width - 2 * gutter,
-                    minx,
-                    maxx,
-                    opts.axisxstep || Math.floor((width - 2 * gutter) / 20),
-                     0,
-                    opts.axisxlabels || false,
-                    paper
-                    
-                    ));
+ //               //chartinst.axis( ax_args, paper)
+ //           );
+            
+           +ax[2] && axis.push(
+               // bottom
+               // x, y, length, from, to, steps, orientation, labels, type, dashsize, paper
+               chartinst.axis(
+                   x + gutter,
+                   y + height - gutter,
+                   width - 2 * gutter,
+                   minx,
+                   maxx,
+                   opts.axisxstep || Math.floor((width - 2 * gutter) / 20),
+                   0,
+                   opts.axisxlabels || false,
+                   paper
+                   
+                   ));
             // left axis
             +ax[3] && axis.push(
-                    chartinst.axis(
-                        x + gutter,
-                        y + height - gutter,
-                        height - 2 * gutter,
-                        miny,
-                        maxy,
-                        opts.axisystep || Math.floor((height - 2 * gutter) / 20),
-                        1,
-                        paper
+                chartinst.axis(
+                x + gutter,
+                y + height - gutter,
+                height - 2 * gutter,
+                miny,
+                maxy,
+                opts.axisystep || Math.floor((height - 2 * gutter) / 20),
+                1,
+                paper
             ));
         }
 
@@ -227,7 +227,7 @@ if (typeof(Raphael) == 'undefined') {
                     "stroke-dasharray": opts.dash || ""
                 }));
             }
-
+            
             var sym = Raphael.is(symbol, "array") ? symbol[i] : symbol,
                 symset = paper.set();
 
@@ -238,7 +238,14 @@ if (typeof(Raphael) == 'undefined') {
                     Y = y + height - gutter - (valuesy[i][j] - miny) * ky;
 
                 (Raphael.is(sym, "array") ? sym[j] : sym) && symset.push(paper[Raphael.is(sym, "array") ? sym[j] : sym](X, Y, (opts.width || 2) * 3).attr({ fill: colors[i], stroke: "none" }));
-
+                
+                var vx = X - (opts.label_padding_x || 0);
+                var vy = Y - (opts.label_padding_y || 10);
+                
+                if(opts.linelabels && opts.linelabels[i] && opts.linelabels[i][j]){
+                    paper.text(vx, vy, opts.linelabels[i][j]);
+                }
+                
                 if (opts.smooth) {
                     if (j && j != jj - 1) {
                         var X0 = x + gutter + ((valuesx[i] || valuesx[0])[j - 1] - minx) * kx,