TopAxisLayout.js revision 5c25e6d712b880e314278e6395068dd208553b98
/**
* Contains algorithms for rendering a top axis.
*
* @module charts
* @class TopAxisLayout
* @constructor
*/
TopAxisLayout = function(){};
/**
* Default margins for text fields.
*
* @private
* @method _getDefaultMargins
* @return Object
*/
_getDefaultMargins: function()
{
return {
top: 0,
left: 0,
right: 0,
bottom: 4
};
},
/**
* Sets the length of the tick on either side of the axis line.
*
* @method setTickOffsets
* @protected
*/
setTickOffsets: function()
{
var host = this,
switch(display)
{
case "inside" :
break;
case "outside" :
break;
case "cross" :
break;
default:
break;
}
},
/**
* Calculates the coordinates for the first point on an axis.
*
* @method getLineStart
* @protected
*/
getLineStart: function()
{
var host = this,
if(display === "outside")
{
pt.y += tickLength;
}
else if(display === "cross")
{
}
return pt;
},
/**
* Draws a tick
*
* @method drawTick
* @param {Path} path reference to the path `Path` element in which to draw the tick.
* @param {Object} pt hash containing x and y coordinates
* @param {Object} tickStyles hash of properties used to draw the tick
* @protected
*/
{
var host = this,
},
/**
* Calculates the point for a label.
*
* @method getLabelPoint
* @param {Object} pt hash containing x and y coordinates
* @return Object
* @protected
*/
getLabelPoint: function(pt)
{
},
/**
* Updates the value for the `maxLabelSize` for use in calculating total size.
*
* @method updateMaxLabelSize
* @param {HTMLElement} label to measure
* @protected
*/
{
var host = this,
props = this._labelRotationProps,
max;
if(rot === 0)
{
max = labelHeight;
}
else if(absRot === 90)
{
max = labelWidth;
}
else
{
}
},
/**
* Determines the available label height when the axis width has been explicitly set.
*
* @method getExplicitlySized
* @return Boolean
* @protected
*/
getExplicitlySized: function(styles)
{
if(this._explicitHeight)
{
var host = this,
h = host._explicitHeight,
return true;
}
return false;
},
/**
* Rotate and position title.
*
* @method positionTitle
* @param {HTMLElement} label to rotate position
* @protected
*/
positionTitle: function(label)
{
var host = this,
{
}
props.x = x;
props.y = y;
},
/**
* Rotate and position labels.
*
* @method positionLabel
* @param {HTMLElement} label to rotate position
* @param {Object} pt hash containing the x and y coordinates in which the label will be positioned
* against.
* @protected
*/
{
var host = this,
totalTitleSize = this._totalTitleSize,
leftOffset = pt.x,
props = this._labelRotationProps,
labelWidth = this._labelWidths[i],
labelHeight = this._labelHeights[i];
if(rot === 0)
{
topOffset -= labelHeight;
}
else
{
if(rot === 90)
{
leftOffset -= labelWidth;
}
else if (rot === -90)
{
}
else if(rot > 0)
{
leftOffset -= labelWidth;
}
else
{
}
}
},
/**
* Adjusts the coordinates of an axis label based on the rotation.
*
* @method _setRotationCoords
* @param {Object} props Coordinates, dimension and rotation properties of the label.
* @protected
*/
_setRotationCoords: function(props)
{
if(rot === 0)
{
}
else
{
if(rot === 90)
{
}
else if (rot === -90)
{
}
else if(rot > 0)
{
}
else
{
}
}
props.x -= leftOffset;
},
/**
* Returns the transformOrigin to use for an axis label based on the position of the axis
* and the rotation of the label.
*
* @method _getTransformOrigin
* @param {Number} rot The rotation (in degrees) of the label.
* @return Array
* @protected
*/
_getTransformOrigin: function(rot)
{
var transformOrigin;
if(rot === 0)
{
}
else
{
if(rot === 90)
{
}
else if (rot === -90)
{
}
else if(rot > 0)
{
}
else
{
}
}
return transformOrigin;
},
/**
* Adjusts position for inner ticks.
*
* @method offsetNodeForTick
* @param {Node} cb contentBox of the axis
* @protected
*/
offsetNodeForTick: function(cb)
{
},
/**
* Assigns a height based on the size of the contents.
*
* @method setCalculatedSize
* @protected
*/
setCalculatedSize: function()
{
var host = this,
if(this._explicitHeight)
{
ttl = this._explicitWidth;
}
}
};