Commits

Anonymous committed cf87aff

Implemented check to see if tick interval was less than precision of format string. If so, adjust ticks so that interval will be greater than tick format string precision. Note, only work if tick Interval and number of ticks are not specified.

  • Participants
  • Parent commits f47d5db

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;
-                var temp = String(this.tickInterval).split('.');
-                var tickPrecision = 0;
-                if (temp.length > 1) {
-                    tickPrecision = temp[1].length;
-                }
                 if (fs) {
                     if (fs.search(/[fFeEgGpP]/) > -1) {
                         var m = fs.match(/\%\.(\d{0,})?[eEfFgGpP]/);
                     }
                     // fact will be <= 1;
                     var fact = Math.pow(10, -precision);
-                    console.log('tickPrecision: %s, precision: %s, fact: %s', tickPrecision, precision, fact);
-                    // if (this.tickInterval < fact) {
-                    if (tickPrecision < precision) {
-                        console.log('low precision: ', tickPrecision, precision);
+                    if (this.tickInterval < fact) {
+                        console.log('low precision: ', this.tickInterval, fact);
                         // need to correct underrange
                         if (userNT == null && userTI == null) {
-                            this.tickInterval = Math.ceil(this.tickInterval*fact)/fact;
+                            this.tickInterval = fact;
                             if (userMax == null && userMin == null) {
                                 // this.min = Math.floor((this._dataBounds.min - this.tickInterval)/fact) * fact;
                                 this.min = Math.floor(this._dataBounds.min/fact) * fact;