Commits

Chris Leonello committed ccd543f

working out bug with offset.

  • Participants
  • Parent commits f59355d

Comments (0)

Files changed (1)

File src/plugins/jqplot.dateAxisRenderer.js

     var daysInMonths = [31,28,31,30,31,30,31,30,31,30,31,30];
     // array of consistent nice intervals.  Longer intervals
     // will depend on days in month, days in year, etc.
-    var niceFormatString = ['%M:%S.%#N', '%M:%S.%#N', '%M:%S.%#N', '%M:%S', '%M:%S', '%M:%S', '%M:%S', '%H:%M:%S', '%H:%M:%S', '%H:%M', '%H:%M', '%H:%M', '%H:%M', '%H:%M', '%H:%M', '%a %H:%M', '%a %H:%M', '%a %H:%M', '%a %H:%M', '%a %H:%M', '%a %H:%M', '%v', '%v', '%v']
+    var niceFormatString = ['%M:%S.%#N', '%M:%S.%#N', '%M:%S.%#N', '%M:%S', '%M:%S', '%M:%S', '%M:%S', '%H:%M:%S', '%H:%M:%S', '%H:%M', '%H:%M', '%H:%M', '%H:%M', '%H:%M', '%H:%M', '%a %H:%M', '%a %H:%M', '%a %H:%M', '%a %H:%M', '%a %H:%M', '%a %H:%M', '%v', '%v', '%v', '%v', '%v']
     var niceIntervalBases = [second, second, second, second, second, second, second, second, second, minute, minute, minute, minute, minute, minute, hour, hour, hour, hour, hour, hour, day, week, week];
-    var niceIntervals = [0.1*second, 0.2*second, 0.5*second, second, 2*second, 5*second, 10*second, 15*second, 30*second, minute, 2*minute, 5*minute, 10*minute, 15*minute, 30*minute, hour, 2*hour, 4*hour, 6*hour, 8*hour, 12*hour, day, week, 2*week];
+    var niceIntervals = [0.1*second, 0.2*second, 0.5*second, second, 2*second, 5*second, 10*second, 15*second, 30*second, minute, 2*minute, 5*minute, 10*minute, 15*minute, 30*minute, hour, 2*hour, 4*hour, 6*hour, 8*hour, 12*hour, day, 2*day, 4*day, week, 2*week];
 
     function bestDateInterval(min, max, titarget) {
         // iterate through niceIntervals to find one closest to titarget
             // want to find a nice interval 
             if (!this.tickInterval) {
                 var tdim = Math.max(dim, threshold+1);
-                var nttarget =  Math.ceil((tdim-threshold)/35 + 1);
+                var nttarget =  Math.ceil((tdim-threshold)/45 + 1);
                 var titarget = (max - min) / (nttarget - 1);
 
+                console.log(nttarget, titarget, titarget/day);
+
                 // If we can use an interval of 2 weeks or less, pick best one
                 if (titarget <= niceIntervals[niceIntervals.length-1] * 1.5) {
                     var ret = bestDateInterval(min, max, titarget);