e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp * Contains algorithms for rendering a top axis.
a75ebc38c1de401b679953a9b87bd323f0f48d02Tripp * @module charts
8648721e29bb657dd5c5ff20f03e86fe50628ce6Tripp * @class TopAxisLayout
8648721e29bb657dd5c5ff20f03e86fe50628ce6Tripp * @constructor
a5057260e5538ddf2faca20fa81271eeff2bf892Tripp * Default margins for text fields.
a5057260e5538ddf2faca20fa81271eeff2bf892Tripp * @method _getDefaultMargins
a5057260e5538ddf2faca20fa81271eeff2bf892Tripp * @return Object
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp * Sets the length of the tick on either side of the axis line.
8648721e29bb657dd5c5ff20f03e86fe50628ce6Tripp * @method setTickOffsets
422668e1d4513bb870b8b576fd9d828c8872f074Tripp * @protected
a5057260e5538ddf2faca20fa81271eeff2bf892Tripp var host = this,
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp case "inside" :
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp case "outside" :
7174b256e7956a8efaff0352e7cac98b942f804fTripp case "cross" :
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp * Calculates the coordinates for the first point on an axis.
8648721e29bb657dd5c5ff20f03e86fe50628ce6Tripp * @method getLineStart
422668e1d4513bb870b8b576fd9d828c8872f074Tripp * @protected
a5057260e5538ddf2faca20fa81271eeff2bf892Tripp var host = this,
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp * Draws a tick
8648721e29bb657dd5c5ff20f03e86fe50628ce6Tripp * @method drawTick
f99edfa53c6ad6f0caab146a750c4404fd898dc3Tripp * @param {Path} path reference to the path `Path` element in which to draw the tick.
8648721e29bb657dd5c5ff20f03e86fe50628ce6Tripp * @param {Object} pt hash containing x and y coordinates
8648721e29bb657dd5c5ff20f03e86fe50628ce6Tripp * @param {Object} tickStyles hash of properties used to draw the tick
422668e1d4513bb870b8b576fd9d828c8872f074Tripp * @protected
a5057260e5538ddf2faca20fa81271eeff2bf892Tripp var host = this,
e393eced613f9b4a5fb6bdd461d0e0bf5064d5ecTripp * Calculates the point for a label.
8648721e29bb657dd5c5ff20f03e86fe50628ce6Tripp * @method getLabelPoint
8648721e29bb657dd5c5ff20f03e86fe50628ce6Tripp * @param {Object} pt hash containing x and y coordinates
8648721e29bb657dd5c5ff20f03e86fe50628ce6Tripp * @return Object
422668e1d4513bb870b8b576fd9d828c8872f074Tripp * @protected
8209f3939e32e0e5bde64192267fdaf9db6f4fbcTripp * Updates the value for the `maxLabelSize` for use in calculating total size.
8648721e29bb657dd5c5ff20f03e86fe50628ce6Tripp * @method updateMaxLabelSize
8648721e29bb657dd5c5ff20f03e86fe50628ce6Tripp * @param {HTMLElement} label to measure
422668e1d4513bb870b8b576fd9d828c8872f074Tripp * @protected
a5057260e5538ddf2faca20fa81271eeff2bf892Tripp var host = this,
14bfa36e35102dbf271dcff98f773a01c75bd503Tripp max = (sinRadians * labelWidth) + (cosRadians * labelHeight);
e1d9c39d1eb1062e5c99cf8994b981636d8841ccTripp host._maxLabelSize = Math.max(host._maxLabelSize, max);
5dc37e5c564d761e7c634eddf5f2e8978db2608cTripp * Determines the available label height when the axis width has been explicitly set.
5dc37e5c564d761e7c634eddf5f2e8978db2608cTripp * @method getExplicitlySized
5dc37e5c564d761e7c634eddf5f2e8978db2608cTripp * @return Boolean
5dc37e5c564d761e7c634eddf5f2e8978db2608cTripp * @protected
5dc37e5c564d761e7c634eddf5f2e8978db2608cTripp var host = this,
68d2a3ded2307a5031fec19a1725a36821ab97a0Tripp host._maxLabelSize = h - (topTickOffset + margin + totalTitleSize);
5dc37e5c564d761e7c634eddf5f2e8978db2608cTripp return true;
5dc37e5c564d761e7c634eddf5f2e8978db2608cTripp return false;
a5057260e5538ddf2faca20fa81271eeff2bf892Tripp * Rotate and position title.
a5057260e5538ddf2faca20fa81271eeff2bf892Tripp * @method positionTitle
a5057260e5538ddf2faca20fa81271eeff2bf892Tripp * @param {HTMLElement} label to rotate position
a5057260e5538ddf2faca20fa81271eeff2bf892Tripp * @protected
a5057260e5538ddf2faca20fa81271eeff2bf892Tripp var host = this,
8648721e29bb657dd5c5ff20f03e86fe50628ce6Tripp * Rotate and position labels.
8648721e29bb657dd5c5ff20f03e86fe50628ce6Tripp * @method positionLabel
8648721e29bb657dd5c5ff20f03e86fe50628ce6Tripp * @param {HTMLElement} label to rotate position
8648721e29bb657dd5c5ff20f03e86fe50628ce6Tripp * @param {Object} pt hash containing the x and y coordinates in which the label will be positioned
422668e1d4513bb870b8b576fd9d828c8872f074Tripp * @protected
a5057260e5538ddf2faca20fa81271eeff2bf892Tripp var host = this,
e1d9c39d1eb1062e5c99cf8994b981636d8841ccTripp topOffset -= labelHeight - (labelHeight * absRot/180);
5c25e6d712b880e314278e6395068dd208553b98Tripp * Adjusts the coordinates of an axis label based on the rotation.
5c25e6d712b880e314278e6395068dd208553b98Tripp * @method _setRotationCoords
5c25e6d712b880e314278e6395068dd208553b98Tripp * @param {Object} props Coordinates, dimension and rotation properties of the label.
5c25e6d712b880e314278e6395068dd208553b98Tripp * @protected
5c25e6d712b880e314278e6395068dd208553b98Tripp * Returns the transformOrigin to use for an axis label based on the position of the axis
5c25e6d712b880e314278e6395068dd208553b98Tripp * and the rotation of the label.
5c25e6d712b880e314278e6395068dd208553b98Tripp * @method _getTransformOrigin
5c25e6d712b880e314278e6395068dd208553b98Tripp * @param {Number} rot The rotation (in degrees) of the label.
5c25e6d712b880e314278e6395068dd208553b98Tripp * @return Array
5c25e6d712b880e314278e6395068dd208553b98Tripp * @protected
8648721e29bb657dd5c5ff20f03e86fe50628ce6Tripp * Adjusts position for inner ticks.
8648721e29bb657dd5c5ff20f03e86fe50628ce6Tripp * @method offsetNodeForTick
8648721e29bb657dd5c5ff20f03e86fe50628ce6Tripp * @param {Node} cb contentBox of the axis
422668e1d4513bb870b8b576fd9d828c8872f074Tripp * @protected
8648721e29bb657dd5c5ff20f03e86fe50628ce6Tripp * Assigns a height based on the size of the contents.
8648721e29bb657dd5c5ff20f03e86fe50628ce6Tripp * @method setCalculatedSize
422668e1d4513bb870b8b576fd9d828c8872f074Tripp * @protected
a5057260e5538ddf2faca20fa81271eeff2bf892Tripp var host = this,
e1d9c39d1eb1062e5c99cf8994b981636d8841ccTripp totalLabelSize = labelMargin.bottom + host._maxLabelSize,