| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
|
| 23 |
|
| 24 |
|
| 25 |
|
| 26 |
|
| 27 |
|
| 28 |
|
| 29 |
|
| 30 |
|
| 31 |
(function($) { |
| 32 |
|
| 33 |
|
| 34 |
|
| 35 |
|
| 36 |
|
| 37 |
|
| 38 |
|
| 39 |
|
| 40 |
|
| 41 |
|
| 42 |
|
| 43 |
|
| 44 |
|
| 45 |
|
| 46 |
|
| 47 |
|
| 48 |
|
| 49 |
|
| 50 |
|
| 51 |
|
| 52 |
|
| 53 |
|
| 54 |
|
| 55 |
|
| 56 |
|
| 57 |
|
| 58 |
|
| 59 |
|
| 60 |
|
| 61 |
|
| 62 |
|
| 63 |
|
| 64 |
|
| 65 |
|
| 66 |
|
| 67 |
|
| 68 |
|
| 69 |
|
| 70 |
|
| 71 |
|
| 72 |
|
| 73 |
|
| 74 |
|
| 75 |
|
| 76 |
|
| 77 |
|
| 78 |
|
| 79 |
|
| 80 |
|
| 81 |
|
| 82 |
|
| 83 |
|
| 84 |
|
| 85 |
|
| 86 |
|
| 87 |
|
| 88 |
|
| 89 |
|
| 90 |
|
| 91 |
|
| 92 |
|
| 93 |
|
| 94 |
|
| 95 |
|
| 96 |
|
| 97 |
|
| 98 |
|
| 99 |
|
| 100 |
|
| 101 |
|
| 102 |
|
| 103 |
|
| 104 |
|
| 105 |
|
| 106 |
|
| 107 |
|
| 108 |
$.jqplot.DateAxisRenderer = function() { |
| 109 |
$.jqplot.LinearAxisRenderer.call(this); |
| 110 |
this.date = new $.jsDate(); |
| 111 |
}; |
| 112 |
|
| 113 |
var second = 1000; |
| 114 |
var minute = 60 * second; |
| 115 |
var hour = 60 * minute; |
| 116 |
var day = 24 * hour; |
| 117 |
var week = 7 * day; |
| 118 |
|
| 119 |
|
| 120 |
var month = 30.4368499 * day; |
| 121 |
var year = 365.242199 * day; |
| 122 |
|
| 123 |
var daysInMonths = [31,28,31,30,31,30,31,30,31,30,31,30]; |
| 124 |
|
| 125 |
|
| 126 |
var niceFormatStrings = ['%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', '%b %e %H:%M', '%b %e %H:%M', '%b %e %H:%M', '%b %e %H:%M', '%v', '%v', '%v', '%v', '%v', '%v', '%v']; |
| 127 |
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, 3*day, 4*day, 5*day, week, 2*week]; |
| 128 |
|
| 129 |
var niceMonthlyIntervals = []; |
| 130 |
|
| 131 |
function bestDateInterval(min, max, titarget) { |
| 132 |
|
| 133 |
var badness = Number.MAX_VALUE; |
| 134 |
var temp, bestTi, bestfmt; |
| 135 |
for (var i=0, l=niceIntervals.length; i < l; i++) { |
| 136 |
temp = Math.abs(titarget - niceIntervals[i]); |
| 137 |
if (temp < badness) { |
| 138 |
badness = temp; |
| 139 |
bestTi = niceIntervals[i]; |
| 140 |
bestfmt = niceFormatStrings[i]; |
| 141 |
} |
| 142 |
} |
| 143 |
|
| 144 |
return [bestTi, bestfmt]; |
| 145 |
} |
| 146 |
|
| 147 |
$.jqplot.DateAxisRenderer.prototype = new $.jqplot.LinearAxisRenderer(); |
| 148 |
$.jqplot.DateAxisRenderer.prototype.constructor = $.jqplot.DateAxisRenderer; |
| 149 |
|
| 150 |
$.jqplot.DateTickFormatter = function(format, val) { |
| 151 |
if (!format) { |
| 152 |
format = '%Y/%m/%d'; |
| 153 |
} |
| 154 |
return $.jsDate.strftime(val, format); |
| 155 |
}; |
| 156 |
|
| 157 |
$.jqplot.DateAxisRenderer.prototype.init = function(options){ |
| 158 |
|
| 159 |
|
| 160 |
|
| 161 |
|
| 162 |
|
| 163 |
this.tickOptions.formatter = $.jqplot.DateTickFormatter; |
| 164 |
|
| 165 |
|
| 166 |
|
| 167 |
|
| 168 |
|
| 169 |
this.tickInset = 0; |
| 170 |
|
| 171 |
|
| 172 |
this.drawBaseline = true; |
| 173 |
|
| 174 |
|
| 175 |
this.baselineWidth = null; |
| 176 |
|
| 177 |
|
| 178 |
this.baselineColor = null; |
| 179 |
this.daTickInterval = null; |
| 180 |
this._daTickInterval = null; |
| 181 |
|
| 182 |
$.extend(true, this, options); |
| 183 |
|
| 184 |
var db = this._dataBounds, |
| 185 |
stats, |
| 186 |
sum, |
| 187 |
s, |
| 188 |
d, |
| 189 |
pd, |
| 190 |
sd, |
| 191 |
intv; |
| 192 |
|
| 193 |
|
| 194 |
|
| 195 |
for (var i=0; i<this._series.length; i++) { |
| 196 |
stats = {intervals:[], frequencies:{}, sortedIntervals:[], min:null, max:null, mean:null}; |
| 197 |
sum = 0; |
| 198 |
s = this._series[i]; |
| 199 |
d = s.data; |
| 200 |
pd = s._plotData; |
| 201 |
sd = s._stackData; |
| 202 |
intv = 0; |
| 203 |
|
| 204 |
for (var j=0; j<d.length; j++) { |
| 205 |
if (this.name == 'xaxis' || this.name == 'x2axis') { |
| 206 |
d[j][0] = new $.jsDate(d[j][0]).getTime(); |
| 207 |
pd[j][0] = new $.jsDate(d[j][0]).getTime(); |
| 208 |
sd[j][0] = new $.jsDate(d[j][0]).getTime(); |
| 209 |
if ((d[j][0] != null && d[j][0] < db.min) || db.min == null) { |
| 210 |
db.min = d[j][0]; |
| 211 |
} |
| 212 |
if ((d[j][0] != null && d[j][0] > db.max) || db.max == null) { |
| 213 |
db.max = d[j][0]; |
| 214 |
} |
| 215 |
if (j>0) { |
| 216 |
intv = Math.abs(d[j][0] - d[j-1][0]); |
| 217 |
stats.intervals.push(intv); |
| 218 |
if (stats.frequencies.hasOwnProperty(intv)) { |
| 219 |
stats.frequencies[intv] += 1; |
| 220 |
} |
| 221 |
else { |
| 222 |
stats.frequencies[intv] = 1; |
| 223 |
} |
| 224 |
} |
| 225 |
sum += intv; |
| 226 |
|
| 227 |
} |
| 228 |
else { |
| 229 |
d[j][1] = new $.jsDate(d[j][1]).getTime(); |
| 230 |
pd[j][1] = new $.jsDate(d[j][1]).getTime(); |
| 231 |
sd[j][1] = new $.jsDate(d[j][1]).getTime(); |
| 232 |
if ((d[j][1] != null && d[j][1] < db.min) || db.min == null) { |
| 233 |
db.min = d[j][1]; |
| 234 |
} |
| 235 |
if ((d[j][1] != null && d[j][1] > db.max) || db.max == null) { |
| 236 |
db.max = d[j][1]; |
| 237 |
} |
| 238 |
if (j>0) { |
| 239 |
intv = Math.abs(d[j][1] - d[j-1][1]); |
| 240 |
stats.intervals.push(intv); |
| 241 |
if (stats.frequencies.hasOwnProperty(intv)) { |
| 242 |
stats.frequencies[intv] += 1; |
| 243 |
} |
| 244 |
else { |
| 245 |
stats.frequencies[intv] = 1; |
| 246 |
} |
| 247 |
} |
| 248 |
} |
| 249 |
sum += intv; |
| 250 |
} |
| 251 |
|
| 252 |
if (s.renderer.bands) { |
| 253 |
if (s.renderer.bands.hiData.length) { |
| 254 |
var bd = s.renderer.bands.hiData; |
| 255 |
for (var j=0, l=bd.length; j < l; j++) { |
| 256 |
if (this.name === 'xaxis' || this.name === 'x2axis') { |
| 257 |
bd[j][0] = new $.jsDate(bd[j][0]).getTime(); |
| 258 |
if ((bd[j][0] != null && bd[j][0] > db.max) || db.max == null) { |
| 259 |
db.max = bd[j][0]; |
| 260 |
} |
| 261 |
} |
| 262 |
else { |
| 263 |
bd[j][1] = new $.jsDate(bd[j][1]).getTime(); |
| 264 |
if ((bd[j][1] != null && bd[j][1] > db.max) || db.max == null) { |
| 265 |
db.max = bd[j][1]; |
| 266 |
} |
| 267 |
} |
| 268 |
} |
| 269 |
} |
| 270 |
if (s.renderer.bands.lowData.length) { |
| 271 |
var bd = s.renderer.bands.lowData; |
| 272 |
for (var j=0, l=bd.length; j < l; j++) { |
| 273 |
if (this.name === 'xaxis' || this.name === 'x2axis') { |
| 274 |
bd[j][0] = new $.jsDate(bd[j][0]).getTime(); |
| 275 |
if ((bd[j][0] != null && bd[j][0] < db.min) || db.min == null) { |
| 276 |
db.min = bd[j][0]; |
| 277 |
} |
| 278 |
} |
| 279 |
else { |
| 280 |
bd[j][1] = new $.jsDate(bd[j][1]).getTime(); |
| 281 |
if ((bd[j][1] != null && bd[j][1] < db.min) || db.min == null) { |
| 282 |
db.min = bd[j][1]; |
| 283 |
} |
| 284 |
} |
| 285 |
} |
| 286 |
} |
| 287 |
} |
| 288 |
|
| 289 |
var tempf = 0, |
| 290 |
tempn=0; |
| 291 |
for (var n in stats.frequencies) { |
| 292 |
stats.sortedIntervals.push({interval:n, frequency:stats.frequencies[n]}); |
| 293 |
} |
| 294 |
stats.sortedIntervals.sort(function(a, b){ |
| 295 |
return b.frequency - a.frequency; |
| 296 |
}); |
| 297 |
|
| 298 |
stats.min = $.jqplot.arrayMin(stats.intervals); |
| 299 |
stats.max = $.jqplot.arrayMax(stats.intervals); |
| 300 |
stats.mean = sum/d.length; |
| 301 |
this._intervalStats.push(stats); |
| 302 |
stats = sum = s = d = pd = sd = null; |
| 303 |
} |
| 304 |
db = null; |
| 305 |
|
| 306 |
}; |
| 307 |
|
| 308 |
|
| 309 |
$.jqplot.DateAxisRenderer.prototype.reset = function() { |
| 310 |
this.min = this._options.min; |
| 311 |
this.max = this._options.max; |
| 312 |
this.tickInterval = this._options.tickInterval; |
| 313 |
this.numberTicks = this._options.numberTicks; |
| 314 |
this._autoFormatString = ''; |
| 315 |
if (this._overrideFormatString && this.tickOptions && this.tickOptions.formatString) { |
| 316 |
this.tickOptions.formatString = ''; |
| 317 |
} |
| 318 |
this.daTickInterval = this._daTickInterval; |
| 319 |
|
| 320 |
}; |
| 321 |
|
| 322 |
$.jqplot.DateAxisRenderer.prototype.createTicks = function(plot) { |
| 323 |
|
| 324 |
var ticks = this._ticks; |
| 325 |
var userTicks = this.ticks; |
| 326 |
var name = this.name; |
| 327 |
|
| 328 |
var db = this._dataBounds; |
| 329 |
var iv = this._intervalStats; |
| 330 |
var dim = (this.name.charAt(0) === 'x') ? this._plotDimensions.width : this._plotDimensions.height; |
| 331 |
var interval; |
| 332 |
var min, max; |
| 333 |
var pos1, pos2; |
| 334 |
var tt, i; |
| 335 |
var threshold = 30; |
| 336 |
var insetMult = 1; |
| 337 |
var daTickInterval = null; |
| 338 |
|
| 339 |
|
| 340 |
if (this.tickInterval != null) |
| 341 |
{ |
| 342 |
|
| 343 |
|
| 344 |
if (Number(this.tickInterval)) { |
| 345 |
daTickInterval = [Number(this.tickInterval), 'seconds']; |
| 346 |
} |
| 347 |
|
| 348 |
else if (typeof this.tickInterval == "string") { |
| 349 |
var parts = this.tickInterval.split(' '); |
| 350 |
if (parts.length == 1) { |
| 351 |
daTickInterval = [1, parts[0]]; |
| 352 |
} |
| 353 |
else if (parts.length == 2) { |
| 354 |
daTickInterval = [parts[0], parts[1]]; |
| 355 |
} |
| 356 |
} |
| 357 |
} |
| 358 |
|
| 359 |
var tickInterval = this.tickInterval; |
| 360 |
|
| 361 |
|
| 362 |
|
| 363 |
|
| 364 |
min = new $.jsDate((this.min != null) ? this.min : db.min).getTime(); |
| 365 |
max = new $.jsDate((this.max != null) ? this.max : db.max).getTime(); |
| 366 |
|
| 367 |
|
| 368 |
|
| 369 |
|
| 370 |
var cursor = plot.plugins.cursor; |
| 371 |
|
| 372 |
if (cursor && cursor._zoom && cursor._zoom.zooming) { |
| 373 |
this.min = null; |
| 374 |
this.max = null; |
| 375 |
} |
| 376 |
|
| 377 |
var range = max - min; |
| 378 |
|
| 379 |
if (this.tickOptions == null || !this.tickOptions.formatString) { |
| 380 |
this._overrideFormatString = true; |
| 381 |
} |
| 382 |
|
| 383 |
if (userTicks.length) { |
| 384 |
|
| 385 |
for (i=0; i<userTicks.length; i++){ |
| 386 |
var ut = userTicks[i]; |
| 387 |
var t = new this.tickRenderer(this.tickOptions); |
| 388 |
if (ut.constructor == Array) { |
| 389 |
t.value = new $.jsDate(ut[0]).getTime(); |
| 390 |
t.label = ut[1]; |
| 391 |
if (!this.showTicks) { |
| 392 |
t.showLabel = false; |
| 393 |
t.showMark = false; |
| 394 |
} |
| 395 |
else if (!this.showTickMarks) { |
| 396 |
t.showMark = false; |
| 397 |
} |
| 398 |
t.setTick(t.value, this.name); |
| 399 |
this._ticks.push(t); |
| 400 |
} |
| 401 |
|
| 402 |
else { |
| 403 |
t.value = new $.jsDate(ut).getTime(); |
| 404 |
if (!this.showTicks) { |
| 405 |
t.showLabel = false; |
| 406 |
t.showMark = false; |
| 407 |
} |
| 408 |
else if (!this.showTickMarks) { |
| 409 |
t.showMark = false; |
| 410 |
} |
| 411 |
t.setTick(t.value, this.name); |
| 412 |
this._ticks.push(t); |
| 413 |
} |
| 414 |
} |
| 415 |
this.numberTicks = userTicks.length; |
| 416 |
this.min = this._ticks[0].value; |
| 417 |
this.max = this._ticks[this.numberTicks-1].value; |
| 418 |
this.daTickInterval = [(this.max - this.min) / (this.numberTicks - 1)/1000, 'seconds']; |
| 419 |
} |
| 420 |
|
| 421 |
|
| 422 |
|
| 423 |
|
| 424 |
|
| 425 |
|
| 426 |
else if (this.min == null && this.max == null && db.min == db.max) |
| 427 |
{ |
| 428 |
var onePointOpts = $.extend(true, {}, this.tickOptions, {name: this.name, value: null}); |
| 429 |
var delta = 300000; |
| 430 |
this.min = db.min - delta; |
| 431 |
this.max = db.max + delta; |
| 432 |
this.numberTicks = 3; |
| 433 |
|
| 434 |
for(var i=this.min;i<=this.max;i+= delta) |
| 435 |
{ |
| 436 |
onePointOpts.value = i; |
| 437 |
|
| 438 |
var t = new this.tickRenderer(onePointOpts); |
| 439 |
|
| 440 |
if (this._overrideFormatString && this._autoFormatString != '') { |
| 441 |
t.formatString = this._autoFormatString; |
| 442 |
} |
| 443 |
|
| 444 |
t.showLabel = false; |
| 445 |
t.showMark = false; |
| 446 |
|
| 447 |
this._ticks.push(t); |
| 448 |
} |
| 449 |
|
| 450 |
if(this.showTicks) { |
| 451 |
this._ticks[1].showLabel = true; |
| 452 |
} |
| 453 |
if(this.showTickMarks) { |
| 454 |
this._ticks[1].showTickMarks = true; |
| 455 |
} |
| 456 |
} |
| 457 |
|
| 458 |
else if (this.min == null && this.max == null) { |
| 459 |
|
| 460 |
var opts = $.extend(true, {}, this.tickOptions, {name: this.name, value: null}); |
| 461 |
|
| 462 |
|
| 463 |
var nttarget, |
| 464 |
titarget; |
| 465 |
|
| 466 |
|
| 467 |
if (!this.tickInterval && !this.numberTicks) { |
| 468 |
var tdim = Math.max(dim, threshold+1); |
| 469 |
|
| 470 |
|
| 471 |
|
| 472 |
|
| 473 |
var spacingFactor = 115; |
| 474 |
if (this.tickRenderer === $.jqplot.CanvasAxisTickRenderer && this.tickOptions.angle) { |
| 475 |
spacingFactor = 115 - 40 * Math.abs(Math.sin(this.tickOptions.angle/180*Math.PI)); |
| 476 |
} |
| 477 |
|
| 478 |
nttarget = Math.ceil((tdim-threshold)/spacingFactor + 1); |
| 479 |
titarget = (max - min) / (nttarget - 1); |
| 480 |
} |
| 481 |
|
| 482 |
|
| 483 |
|
| 484 |
|
| 485 |
|
| 486 |
|
| 487 |
else if (this.tickInterval) { |
| 488 |
titarget = new $.jsDate(0).add(daTickInterval[0], daTickInterval[1]).getTime(); |
| 489 |
} |
| 490 |
|
| 491 |
|
| 492 |
|
| 493 |
else if (this.numberTicks) { |
| 494 |
nttarget = this.numberTicks; |
| 495 |
titarget = (max - min) / (nttarget - 1); |
| 496 |
} |
| 497 |
|
| 498 |
|
| 499 |
if (titarget <= 19*day) { |
| 500 |
var ret = bestDateInterval(min, max, titarget); |
| 501 |
var tempti = ret[0]; |
| 502 |
this._autoFormatString = ret[1]; |
| 503 |
|
| 504 |
min = new $.jsDate(min); |
| 505 |
min = Math.floor((min.getTime() - min.getUtcOffset())/tempti) * tempti + min.getUtcOffset(); |
| 506 |
|
| 507 |
nttarget = Math.ceil((max - min) / tempti) + 1; |
| 508 |
this.min = min; |
| 509 |
this.max = min + (nttarget - 1) * tempti; |
| 510 |
|
| 511 |
|
| 512 |
if (this.max < max) { |
| 513 |
this.max += tempti; |
| 514 |
nttarget += 1; |
| 515 |
} |
| 516 |
this.tickInterval = tempti; |
| 517 |
this.numberTicks = nttarget; |
| 518 |
|
| 519 |
for (var i=0; i<nttarget; i++) { |
| 520 |
opts.value = this.min + i * tempti; |
| 521 |
t = new this.tickRenderer(opts); |
| 522 |
|
| 523 |
if (this._overrideFormatString && this._autoFormatString != '') { |
| 524 |
t.formatString = this._autoFormatString; |
| 525 |
} |
| 526 |
if (!this.showTicks) { |
| 527 |
t.showLabel = false; |
| 528 |
t.showMark = false; |
| 529 |
} |
| 530 |
else if (!this.showTickMarks) { |
| 531 |
t.showMark = false; |
| 532 |
} |
| 533 |
this._ticks.push(t); |
| 534 |
} |
| 535 |
|
| 536 |
insetMult = this.tickInterval; |
| 537 |
} |
| 538 |
|
| 539 |
|
| 540 |
else if (titarget <= 9 * month) { |
| 541 |
|
| 542 |
this._autoFormatString = '%v'; |
| 543 |
|
| 544 |
|
| 545 |
var intv = Math.round(titarget/month); |
| 546 |
if (intv < 1) { |
| 547 |
intv = 1; |
| 548 |
} |
| 549 |
else if (intv > 6) { |
| 550 |
intv = 6; |
| 551 |
} |
| 552 |
|
| 553 |
|
| 554 |
var mstart = new $.jsDate(min).setDate(1).setHours(0,0,0,0); |
| 555 |
|
| 556 |
|
| 557 |
var tempmend = new $.jsDate(max); |
| 558 |
var mend = new $.jsDate(max).setDate(1).setHours(0,0,0,0); |
| 559 |
|
| 560 |
if (tempmend.getTime() !== mend.getTime()) { |
| 561 |
mend = mend.add(1, 'month'); |
| 562 |
} |
| 563 |
|
| 564 |
var nmonths = mend.diff(mstart, 'month'); |
| 565 |
|
| 566 |
nttarget = Math.ceil(nmonths/intv) + 1; |
| 567 |
|
| 568 |
this.min = mstart.getTime(); |
| 569 |
this.max = mstart.clone().add((nttarget - 1) * intv, 'month').getTime(); |
| 570 |
this.numberTicks = nttarget; |
| 571 |
|
| 572 |
for (var i=0; i<nttarget; i++) { |
| 573 |
if (i === 0) { |
| 574 |
opts.value = mstart.getTime(); |
| 575 |
} |
| 576 |
else { |
| 577 |
opts.value = mstart.add(intv, 'month').getTime(); |
| 578 |
} |
| 579 |
t = new this.tickRenderer(opts); |
| 580 |
|
| 581 |
if (this._overrideFormatString && this._autoFormatString != '') { |
| 582 |
t.formatString = this._autoFormatString; |
| 583 |
} |
| 584 |
if (!this.showTicks) { |
| 585 |
t.showLabel = false; |
| 586 |
t.showMark = false; |
| 587 |
} |
| 588 |
else if (!this.showTickMarks) { |
| 589 |
t.showMark = false; |
| 590 |
} |
| 591 |
this._ticks.push(t); |
| 592 |
} |
| 593 |
|
| 594 |
insetMult = intv * month; |
| 595 |
} |
| 596 |
|
| 597 |
|
| 598 |
else { |
| 599 |
|
| 600 |
this._autoFormatString = '%v'; |
| 601 |
|
| 602 |
|
| 603 |
var intv = Math.round(titarget/year); |
| 604 |
if (intv < 1) { |
| 605 |
intv = 1; |
| 606 |
} |
| 607 |
|
| 608 |
|
| 609 |
var mstart = new $.jsDate(min).setMonth(0, 1).setHours(0,0,0,0); |
| 610 |
var mend = new $.jsDate(max).add(1, 'year').setMonth(0, 1).setHours(0,0,0,0); |
| 611 |
|
| 612 |
var nyears = mend.diff(mstart, 'year'); |
| 613 |
|
| 614 |
nttarget = Math.ceil(nyears/intv) + 1; |
| 615 |
|
| 616 |
this.min = mstart.getTime(); |
| 617 |
this.max = mstart.clone().add((nttarget - 1) * intv, 'year').getTime(); |
| 618 |
this.numberTicks = nttarget; |
| 619 |
|
| 620 |
for (var i=0; i<nttarget; i++) { |
| 621 |
if (i === 0) { |
| 622 |
opts.value = mstart.getTime(); |
| 623 |
} |
| 624 |
else { |
| 625 |
opts.value = mstart.add(intv, 'year').getTime(); |
| 626 |
} |
| 627 |
t = new this.tickRenderer(opts); |
| 628 |
|
| 629 |
if (this._overrideFormatString && this._autoFormatString != '') { |
| 630 |
t.formatString = this._autoFormatString; |
| 631 |
} |
| 632 |
if (!this.showTicks) { |
| 633 |
t.showLabel = false; |
| 634 |
t.showMark = false; |
| 635 |
} |
| 636 |
else if (!this.showTickMarks) { |
| 637 |
t.showMark = false; |
| 638 |
} |
| 639 |
this._ticks.push(t); |
| 640 |
} |
| 641 |
|
| 642 |
insetMult = intv * year; |
| 643 |
} |
| 644 |
} |
| 645 |
|
| 646 |
|
| 647 |
|
| 648 |
|
| 649 |
|
| 650 |
else { |
| 651 |
if (name == 'xaxis' || name == 'x2axis') { |
| 652 |
dim = this._plotDimensions.width; |
| 653 |
} |
| 654 |
else { |
| 655 |
dim = this._plotDimensions.height; |
| 656 |
} |
| 657 |
|
| 658 |
|
| 659 |
if (this.min != null && this.max != null && this.numberTicks != null) { |
| 660 |
this.tickInterval = null; |
| 661 |
} |
| 662 |
|
| 663 |
if (this.tickInterval != null && daTickInterval != null) { |
| 664 |
this.daTickInterval = daTickInterval; |
| 665 |
} |
| 666 |
|
| 667 |
|
| 668 |
if (min == max) { |
| 669 |
var adj = 24*60*60*500; |
| 670 |
min -= adj; |
| 671 |
max += adj; |
| 672 |
} |
| 673 |
|
| 674 |
range = max - min; |
| 675 |
|
| 676 |
var optNumTicks = 2 + parseInt(Math.max(0, dim-100)/100, 10); |
| 677 |
|
| 678 |
|
| 679 |
var rmin, rmax; |
| 680 |
|
| 681 |
rmin = (this.min != null) ? new $.jsDate(this.min).getTime() : min - range/2*(this.padMin - 1); |
| 682 |
rmax = (this.max != null) ? new $.jsDate(this.max).getTime() : max + range/2*(this.padMax - 1); |
| 683 |
this.min = rmin; |
| 684 |
this.max = rmax; |
| 685 |
range = this.max - this.min; |
| 686 |
|
| 687 |
if (this.numberTicks == null){ |
| 688 |
|
| 689 |
|
| 690 |
if (this.daTickInterval != null) { |
| 691 |
var nc = new $.jsDate(this.max).diff(this.min, this.daTickInterval[1], true); |
| 692 |
this.numberTicks = Math.ceil(nc/this.daTickInterval[0]) +1; |
| 693 |
|
| 694 |
this.max = new $.jsDate(this.min).add((this.numberTicks-1) * this.daTickInterval[0], this.daTickInterval[1]).getTime(); |
| 695 |
} |
| 696 |
else if (dim > 200) { |
| 697 |
this.numberTicks = parseInt(3+(dim-200)/100, 10); |
| 698 |
} |
| 699 |
else { |
| 700 |
this.numberTicks = 2; |
| 701 |
} |
| 702 |
} |
| 703 |
|
| 704 |
insetMult = range / (this.numberTicks-1)/1000; |
| 705 |
|
| 706 |
if (this.daTickInterval == null) { |
| 707 |
this.daTickInterval = [insetMult, 'seconds']; |
| 708 |
} |
| 709 |
|
| 710 |
|
| 711 |
for (var i=0; i<this.numberTicks; i++){ |
| 712 |
var min = new $.jsDate(this.min); |
| 713 |
tt = min.add(i*this.daTickInterval[0], this.daTickInterval[1]).getTime(); |
| 714 |
var t = new this.tickRenderer(this.tickOptions); |
| 715 |
|
| 716 |
if (!this.showTicks) { |
| 717 |
t.showLabel = false; |
| 718 |
t.showMark = false; |
| 719 |
} |
| 720 |
else if (!this.showTickMarks) { |
| 721 |
t.showMark = false; |
| 722 |
} |
| 723 |
t.setTick(tt, this.name); |
| 724 |
this._ticks.push(t); |
| 725 |
} |
| 726 |
} |
| 727 |
|
| 728 |
if (this.tickInset) { |
| 729 |
this.min = this.min - this.tickInset * insetMult; |
| 730 |
this.max = this.max + this.tickInset * insetMult; |
| 731 |
} |
| 732 |
|
| 733 |
if (this._daTickInterval == null) { |
| 734 |
this._daTickInterval = this.daTickInterval; |
| 735 |
} |
| 736 |
|
| 737 |
ticks = null; |
| 738 |
}; |
| 739 |
|
| 740 |
})(jQuery); |
| 741 |
|