Commits

Chris Leonello committed fcc7854

Handle tick precision for case where max specified but not min.

Comments (0)

Files changed (1)

src/jqplot.linearAxisRenderer.js

                 // use the tick formatString or, the default.
                 var fs = temptick.formatString || $.jqplot.config.defaultTickFormatString; 
                 var fs = fs.match($.jqplot.sprintf.regex)[0];
-                console.log('fs is: ', fs);
                 var precision = 0;
                 if (fs) {
                     if (fs.search(/[fFeEgGpP]/) > -1) {
                     // fact will be <= 1;
                     var fact = Math.pow(10, -precision);
                     if (this.tickInterval < fact) {
-                        console.log('low precision: ', this.tickInterval, fact);
                         // need to correct underrange
                         if (userNT == null && userTI == null) {
                             this.tickInterval = fact;
                                 this.numberTicks = Math.ceil((this._dataBounds.max - this.min) / this.tickInterval) + 2;
                                 this.max = this.min + this.tickInterval * (this.numberTicks-1);
                             }
-                            console.log('now have: ', this.min, this.max, this.tickInterval);
+                            else if (userMin == null) {
+                                // add one tick for bottom of range.
+                                this.numberTicks = Math.ceil((this._dataBounds.max - this.min) / this.tickInterval) + 2;
+                                this.min = this.max - this.tickInterval * (this.numberTicks-1);
+                            }
                         }
                     }
                 }