Tried fixing jqplot crashing problem using diff provided on https://bitbucket.org/cleonello/jqplot/issue/552/jqplot-crashes-when-interval-too-small
This commit is contained in:
parent
8016ac4977
commit
759df40f08
@ -335,6 +335,28 @@
|
||||
var threshold = 30;
|
||||
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;
|
||||
|
||||
// if we already have ticks, use them.
|
||||
@ -464,7 +486,7 @@
|
||||
// tickInterval will be used before numberTicks, that is if
|
||||
// both are specified, numberTicks will be ignored.
|
||||
else if (this.tickInterval) {
|
||||
titarget = this.tickInterval;
|
||||
titarget = new $.jsDate(0).add(daTickInterval[0], daTickInterval[1]).getTime();
|
||||
}
|
||||
|
||||
// if numberTicks specified, try to honor it.
|
||||
@ -480,9 +502,10 @@
|
||||
var tempti = ret[0];
|
||||
this._autoFormatString = ret[1];
|
||||
|
||||
min = Math.floor(min/tempti) * tempti;
|
||||
//min = Math.floor(min/tempti) * tempti;
|
||||
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;
|
||||
this.min = min;
|
||||
@ -640,7 +663,7 @@
|
||||
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 interval is a number or can be converted to one, use it.
|
||||
@ -658,8 +681,12 @@
|
||||
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 == max) {
|
||||
var adj = 24*60*60*500; // 1/2 day
|
||||
|
||||
Loading…
Reference in New Issue
Block a user