|
@ -208,23 +208,34 @@ TimeAxis.prototype._repaintLabels = function () { |
|
|
var isMajor; |
|
|
var isMajor; |
|
|
var xPrev = 0; |
|
|
var xPrev = 0; |
|
|
var width = 0; |
|
|
var width = 0; |
|
|
|
|
|
var prevLine; |
|
|
var xFirstMajorLabel = undefined; |
|
|
var xFirstMajorLabel = undefined; |
|
|
var max = 0; |
|
|
var max = 0; |
|
|
|
|
|
var className; |
|
|
|
|
|
|
|
|
step.first(); |
|
|
step.first(); |
|
|
while (step.hasNext() && max < 1000) { |
|
|
while (step.hasNext() && max < 1000) { |
|
|
max++; |
|
|
max++; |
|
|
|
|
|
|
|
|
cur = step.getCurrent(); |
|
|
cur = step.getCurrent(); |
|
|
isMajor = step.isMajor(); |
|
|
isMajor = step.isMajor(); |
|
|
|
|
|
className = step.getClassName(); |
|
|
|
|
|
|
|
|
xPrev = x; |
|
|
xPrev = x; |
|
|
x = this.body.util.toScreen(cur); |
|
|
x = this.body.util.toScreen(cur); |
|
|
width = x - xPrev; |
|
|
width = x - xPrev; |
|
|
|
|
|
if (prevLine) { |
|
|
|
|
|
prevLine.style.width = width + 'px'; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// FIXME: the width is not always correct, for example on the month scale.
|
|
|
|
|
|
|
|
|
if (this.options.showMinorLabels) { |
|
|
if (this.options.showMinorLabels) { |
|
|
this._repaintMinorText(x, step.getLabelMinor(), orientation); |
|
|
this._repaintMinorText(x, step.getLabelMinor(), orientation); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// FIXME: the divs must be ordered so that you can use css odd/even classes
|
|
|
|
|
|
|
|
|
if (isMajor && this.options.showMajorLabels) { |
|
|
if (isMajor && this.options.showMajorLabels) { |
|
|
if (x > 0) { |
|
|
if (x > 0) { |
|
|
if (xFirstMajorLabel == undefined) { |
|
|
if (xFirstMajorLabel == undefined) { |
|
@ -233,11 +244,11 @@ TimeAxis.prototype._repaintLabels = function () { |
|
|
this._repaintMajorText(x, step.getLabelMajor(), orientation); |
|
|
this._repaintMajorText(x, step.getLabelMajor(), orientation); |
|
|
} |
|
|
} |
|
|
if (this.options.showMajorLines == true) { |
|
|
if (this.options.showMajorLines == true) { |
|
|
this._repaintMajorLine(x, width, orientation); |
|
|
|
|
|
|
|
|
prevLine = this._repaintMajorLine(x, orientation, className); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
else if (this.options.showMinorLines == true) { |
|
|
else if (this.options.showMinorLines == true) { |
|
|
this._repaintMinorLine(x, width, orientation); |
|
|
|
|
|
|
|
|
prevLine = this._repaintMinorLine(x, orientation, className); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
step.next(); |
|
|
step.next(); |
|
@ -324,18 +335,18 @@ TimeAxis.prototype._repaintMajorText = function (x, text, orientation) { |
|
|
/** |
|
|
/** |
|
|
* Create a minor line for the axis at position x |
|
|
* Create a minor line for the axis at position x |
|
|
* @param {Number} x |
|
|
* @param {Number} x |
|
|
* @param {Number} width |
|
|
|
|
|
* @param {String} orientation "top" or "bottom" (default) |
|
|
* @param {String} orientation "top" or "bottom" (default) |
|
|
|
|
|
* @param {String} className |
|
|
|
|
|
* @return {Element} Returns the created line |
|
|
* @private |
|
|
* @private |
|
|
*/ |
|
|
*/ |
|
|
TimeAxis.prototype._repaintMinorLine = function (x, width, orientation) { |
|
|
|
|
|
|
|
|
TimeAxis.prototype._repaintMinorLine = function (x, orientation, className) { |
|
|
// reuse redundant line
|
|
|
// reuse redundant line
|
|
|
var line = this.dom.redundant.minorLines.shift(); |
|
|
var line = this.dom.redundant.minorLines.shift(); |
|
|
|
|
|
|
|
|
if (!line) { |
|
|
if (!line) { |
|
|
// create vertical line
|
|
|
// create vertical line
|
|
|
line = document.createElement('div'); |
|
|
line = document.createElement('div'); |
|
|
line.className = 'grid vertical minor'; |
|
|
|
|
|
this.dom.background.appendChild(line); |
|
|
this.dom.background.appendChild(line); |
|
|
} |
|
|
} |
|
|
this.dom.minorLines.push(line); |
|
|
this.dom.minorLines.push(line); |
|
@ -348,25 +359,28 @@ TimeAxis.prototype._repaintMinorLine = function (x, width, orientation) { |
|
|
line.style.top = this.body.domProps.top.height + 'px'; |
|
|
line.style.top = this.body.domProps.top.height + 'px'; |
|
|
} |
|
|
} |
|
|
line.style.height = props.minorLineHeight + 'px'; |
|
|
line.style.height = props.minorLineHeight + 'px'; |
|
|
line.style.width = width + 'px'; |
|
|
|
|
|
line.style.left = (x - props.minorLineWidth / 2) + 'px'; |
|
|
line.style.left = (x - props.minorLineWidth / 2) + 'px'; |
|
|
|
|
|
|
|
|
|
|
|
line.className = 'grid vertical minor ' + className; |
|
|
|
|
|
|
|
|
|
|
|
return line; |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* Create a Major line for the axis at position x |
|
|
* Create a Major line for the axis at position x |
|
|
* @param {Number} x |
|
|
* @param {Number} x |
|
|
* @param {Number} width |
|
|
|
|
|
* @param {String} orientation "top" or "bottom" (default) |
|
|
* @param {String} orientation "top" or "bottom" (default) |
|
|
|
|
|
* @param {String} className |
|
|
|
|
|
* @return {Element} Returns the created line |
|
|
* @private |
|
|
* @private |
|
|
*/ |
|
|
*/ |
|
|
TimeAxis.prototype._repaintMajorLine = function (x, width, orientation) { |
|
|
|
|
|
|
|
|
TimeAxis.prototype._repaintMajorLine = function (x, orientation, className) { |
|
|
// reuse redundant line
|
|
|
// reuse redundant line
|
|
|
var line = this.dom.redundant.majorLines.shift(); |
|
|
var line = this.dom.redundant.majorLines.shift(); |
|
|
|
|
|
|
|
|
if (!line) { |
|
|
if (!line) { |
|
|
// create vertical line
|
|
|
// create vertical line
|
|
|
line = document.createElement('DIV'); |
|
|
line = document.createElement('DIV'); |
|
|
line.className = 'grid vertical major'; |
|
|
|
|
|
this.dom.background.appendChild(line); |
|
|
this.dom.background.appendChild(line); |
|
|
} |
|
|
} |
|
|
this.dom.majorLines.push(line); |
|
|
this.dom.majorLines.push(line); |
|
@ -379,8 +393,11 @@ TimeAxis.prototype._repaintMajorLine = function (x, width, orientation) { |
|
|
line.style.top = this.body.domProps.top.height + 'px'; |
|
|
line.style.top = this.body.domProps.top.height + 'px'; |
|
|
} |
|
|
} |
|
|
line.style.left = (x - props.majorLineWidth / 2) + 'px'; |
|
|
line.style.left = (x - props.majorLineWidth / 2) + 'px'; |
|
|
line.style.width = width + 'px'; |
|
|
|
|
|
line.style.height = props.majorLineHeight + 'px'; |
|
|
line.style.height = props.majorLineHeight + 'px'; |
|
|
|
|
|
|
|
|
|
|
|
line.className = 'grid vertical major ' + className; |
|
|
|
|
|
|
|
|
|
|
|
return line; |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|