Commits

Anonymous committed 9485ae9

Fixed bug #2 where tick interval options wasn't working correctly.

  • Participants
  • Parent commits 571de32

Comments (0)

Files changed (2)

File src/jqplot.linearAxisRenderer.js

             }
             
             // if max, min, and interval specified and interval won't fit, ignore interval.
-            if (this.min != null && this.max != null && this.tickInterval != null) {
-                if (parseInt((this.max-this.min)/this.tickInterval, 10) != (this.max-this.min)/this.tickInterval) {
-                    this.tickInterval = null;
-                }
-            }
+            // if (this.min != null && this.max != null && this.tickInterval != null) {
+            //     if (parseInt((this.max-this.min)/this.tickInterval, 10) != (this.max-this.min)/this.tickInterval) {
+            //         this.tickInterval = null;
+            //     }
+            // }
         
             min = ((this.min != null) ? this.min : db.min);
             max = ((this.max != null) ? this.max : db.max);
                 // if tickInterval is specified by user, we will ignore computed maximum.
                 // max will be equal or greater to fit even # of ticks.
                 if (this.tickInterval != null) {
-                    this.numberTicks = Math.ceil((this.max - this.min)/this.tickInterval);
-                    this.max = this.min + this.tickInterval*this.numberTicks;
+                    this.numberTicks = Math.ceil((this.max - this.min)/this.tickInterval)+1;
+                    this.max = this.min + this.tickInterval*(this.numberTicks-1);
                 }
-                if (dim > 100) {
+                else if (dim > 100) {
                     this.numberTicks = parseInt(3+(dim-100)/75, 10);
                 }
                 else {

File src/plugins/jqplot.dateAxisRenderer.js

                     var nc = Date.create(this.max).diff(this.min, this._tickInterval[1], true);
                     this.numberTicks = Math.ceil(nc/this._tickInterval[0]) +1;
                     //log(this._tickInterval, nc, this.numberTicks);
-                    this.max = Date.create(this.min).add(this.numberTicks-1, this._tickInterval[1]).getTime();
+                    // this.max = Date.create(this.min).add(this.numberTicks-1, this._tickInterval[1]).getTime();
+                    this.max = Date.create(this.min).add((this.numberTicks-1) * this._tickInterval[0], this._tickInterval[1]).getTime();
                 }
                 else if (dim > 100) {
                     this.numberTicks = parseInt(3+(dim-100)/75, 10);