Commits

Anonymous committed 9f68ea4

Fixed grid renderer to properly handle drawing axis baslines.
Update docs in core.

Comments (0)

Files changed (2)

src/jqplot.canvasGridRenderer.js

             var ticks = axis._ticks;
             var numticks = ticks.length;
             if (axis.show) {
+                if (axis.drawBaseline) {
+                    var bopts = {};
+                    if (axis.baselineWidth !== null) {
+                        bopts.lineWidth = axis.baselineWidth;
+                    }
+                    if (axis.baselineColor !== null) {
+                        bopts.strokeStyle = axis.baselineColor;
+                    }
+                    switch (name) {
+                        case 'xaxis':
+                            drawLine (this._left, this._bottom, this._right, this._bottom, bopts);
+                            break;
+                        case 'yaxis':
+                            drawLine (this._left, this._bottom, this._left, this._top, bopts);
+                            break;
+                        case 'x2axis':
+                            drawLine (this._left, this._bottom, this._right, this._bottom, bopts);
+                            break;
+                        case 'y2axis':
+                            drawLine (this._right, this._bottom, this._right, this._top, bopts);
+                            break;
+                    }
+                }
                 for (var j=numticks; j>0; j--) {
                     var t = ticks[j-1];
                     if (t.show) {
                                 if (t.showGridline && this.drawGridlines) {
                                     drawLine(pos, this._top, pos, this._bottom);
                                 }
-                                // else if first tick and show y baseline
-                                else if (j === 1 && axes.yaxis.show && axes.yaxis.drawBaseline) {
-                                    drawLine(pos, this._top, pos, this._bottom);
-                                }
-                                // else if last tick and show y2 baseline
-                                else if (j === numticks && axes.y2axis.show && axes.y2axis.drawBaseline) {
-                                    drawLine(pos, this._top, pos, this._bottom);
-                                }
-                                
                                 // draw the mark
                                 if (t.showMark && t.mark) {
                                     s = t.markSize;
                                 if (t.showGridline && this.drawGridlines) {
                                     drawLine(this._right, pos, this._left, pos);
                                 }
-                                // else if first tick and show x baseline
-                                else if (j === 1 && axes.xaxis.show && axes.xaxis.drawBaseline) {
-                                    drawLine(this._right, pos, this._left, pos);
-                                }
-                                // else if last tick and show x2 baseline
-                                else if (j === numticks && axes.x2axis.show && axes.x2axis.drawBaseline) {
-                                    drawLine(this._right, pos, this._left, pos);
-                                }
                                 // draw the mark
                                 if (t.showMark && t.mark) {
                                     s = t.markSize;
                                 if (t.showGridline && this.drawGridlines) {
                                     drawLine(pos, this._bottom, pos, this._top);
                                 }
-                                // else if first tick and show y baseline
-                                else if (j === 1 && axes.yaxis.show && axes.yaxis.drawBaseline) {
-                                    drawLine(pos, this._bottom, pos, this._top);
-                                }
-                                // else if last tick and show y2 baseline
-                                else if (j === numticks && axes.y2axis.show && axes.y2axis.drawBaseline) {
-                                    drawLine(pos, this._bottom, pos, this._top);
-                                }
                                 // draw the mark
                                 if (t.showMark && t.mark) {
                                     s = t.markSize;
                                 if (t.showGridline && this.drawGridlines) {
                                     drawLine(this._left, pos, this._right, pos);
                                 }
-                                // else if first tick and show x baseline
-                                else if (j === 1 && axes.xaxis.show && axes.xaxis.drawBaseline) {
-                                    drawLine(this._left, pos, this._right, pos);
-                                }
-                                // else if last tick and show x2 baseline
-                                else if (j === numticks && axes.x2axis.show && axes.x2axis.drawBaseline) {
-                                    drawLine(this._left, pos, this._right, pos);
-                                }
                                 // draw the mark
                                 if (t.showMark && t.mark) {
                                     s = t.markSize;

src/jqplot.core.js

         // maximum value of the axis (in data units, not pixels).
         this.max=null;
         // prop: autoscale
-        // Autoscale the axis min and max values to provide sensible tick spacing.
-        // If axis min or max are set, autoscale will be turned off.
-        // The numberTicks, tickInterval and pad options do work with 
-        // autoscale, although tickInterval has not been tested yet.
-        // padMin and padMax do nothing when autoscale is on.
+        // DEPRECATED
+        // the default scaling algorithm produces superior results.
         this.autoscale = false;
         // prop: pad
         // Padding to extend the range above and below the data bounds.