This commit is contained in:
Atul Pratap Singh 2012-07-29 19:15:14 +05:30
parent 8016ac4977
commit 759df40f08

View File

@ -335,6 +335,28 @@
var threshold = 30; var threshold = 30;
var insetMult = 1; var insetMult = 1;
var daTickInterval = null;
// if user specified a tick interval, convert to usable.
if (this.tickInterval != null)
{
// if interval is a number or can be converted to one, use it.
// Assume it is in SECONDS!!!
if (Number(this.tickInterval)) {
daTickInterval = [Number(this.tickInterval), 'seconds'];
}
// else, parse out something we can build from.
else if (typeof this.tickInterval == "string") {
var parts = this.tickInterval.split(' ');
if (parts.length == 1) {
daTickInterval = [1, parts[0]];
}
else if (parts.length == 2) {
daTickInterval = [parts[0], parts[1]];
}
}
}
var tickInterval = this.tickInterval; var tickInterval = this.tickInterval;
// if we already have ticks, use them. // if we already have ticks, use them.
@ -464,7 +486,7 @@
// tickInterval will be used before numberTicks, that is if // tickInterval will be used before numberTicks, that is if
// both are specified, numberTicks will be ignored. // both are specified, numberTicks will be ignored.
else if (this.tickInterval) { else if (this.tickInterval) {
titarget = this.tickInterval; titarget = new $.jsDate(0).add(daTickInterval[0], daTickInterval[1]).getTime();
} }
// if numberTicks specified, try to honor it. // if numberTicks specified, try to honor it.
@ -480,9 +502,10 @@
var tempti = ret[0]; var tempti = ret[0];
this._autoFormatString = ret[1]; this._autoFormatString = ret[1];
min = Math.floor(min/tempti) * tempti; //min = Math.floor(min/tempti) * tempti;
min = new $.jsDate(min); min = new $.jsDate(min);
min = min.getTime() + min.getUtcOffset(); //min = min.getTime() + min.getUtcOffset();
min = Math.floor((min.getTime() - min.getUtcOffset())/tempti) * tempti + min.getUtcOffset();
nttarget = Math.ceil((max - min) / tempti) + 1; nttarget = Math.ceil((max - min) / tempti) + 1;
this.min = min; this.min = min;
@ -640,7 +663,7 @@
this.tickInterval = null; this.tickInterval = null;
} }
// if user specified a tick interval, convert to usable. /* // if user specified a tick interval, convert to usable.
if (this.tickInterval != null) if (this.tickInterval != null)
{ {
// if interval is a number or can be converted to one, use it. // if interval is a number or can be converted to one, use it.
@ -658,7 +681,11 @@
this.daTickInterval = [parts[0], parts[1]]; this.daTickInterval = [parts[0], parts[1]];
} }
} }
} }*/
if (this.tickInterval != null && daTickInterval != null) {
this.daTickInterval = daTickInterval;
}
// if min and max are same, space them out a bit // if min and max are same, space them out a bit
if (min == max) { if (min == max) {