2 YUI 3.13.0 (build 508226d)
3 Copyright 2013 Yahoo! Inc. All rights reserved.
4 Licensed under the BSD License.
5 http://yuilibrary.com/license/
8 YUI.add('axis-time', function (Y, NAME) {
11 * Provides functionality for drawing a time axis for use with a chart.
14 * @submodule axis-time
17 * TimeAxis draws a time-based axis for a chart.
23 * @param {Object} config (optional) Configuration parameters.
24 * @submodule axis-time
26 Y.TimeAxis = Y.Base.create("timeAxis", Y.Axis, [Y.TimeImpl], {
28 * Calculates and returns a value based on the number of labels and the index of
31 * @method _getLabelByIndex
32 * @param {Number} i Index of the label.
33 * @param {Number} l Total number of labels.
37 _getLabelByIndex: function(i, l)
39 var min = this.get("minimum"),
40 max = this.get("maximum"),
44 increm = ((max - min)/l) * i;
50 * Returns an object literal containing and array of label values and an array of points.
52 * @method _getLabelData
53 * @param {Object} startPoint An object containing x and y values.
54 * @param {Number} edgeOffset Distance to offset coordinates.
55 * @param {Number} layoutLength Distance that the axis spans.
56 * @param {Number} count Number of labels.
57 * @param {String} direction Indicates whether the axis is horizontal or vertical.
58 * @param {Array} Array containing values for axis labels.
62 _getLabelData: function(constantVal, staticCoord, dynamicCoord, min, max, edgeOffset, layoutLength, count, dataValues)
70 dataValues = dataValues || this._getDataValuesByCount(count, min, max);
71 for(i = 0; i < count; i = i + 1)
73 dataValue = this._getNumber(dataValues[i]);
74 if(dataValue <= max && dataValue >= min)
77 point[staticCoord] = constantVal;
78 point[dynamicCoord] = this._getCoordFromValue(
86 values.push(dataValue);
98 }, '3.13.0', {"requires": ["axis", "axis-time-base"]});