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-category', function (Y, NAME) {
11
* Provides functionality for drawing a category axis for use with a chart.
14
* @submodule axis-category
18
* CategoryAxis draws a category axis for a chart.
24
* @param {Object} config (optional) Configuration parameters.
25
* @submodule axis-category
27
Y.CategoryAxis = Y.Base.create("categoryAxis", Y.Axis, [Y.CategoryImpl], {
29
* Returns a string corresponding to the first label on an
32
* @method getMinimumValue
35
getMinimumValue: function()
37
var data = this.get("data"),
43
* Returns a string corresponding to the last label on an
46
* @method getMaximumValue
49
getMaximumValue: function()
51
var data = this.get("data"),
52
len = data.length - 1,
58
* Calculates and returns a value based on the number of labels and the index of
61
* @method _getLabelByIndex
62
* @param {Number} i Index of the label.
66
_getLabelByIndex: function(i)
69
data = this.get("data");
75
* Returns an object literal containing and array of label values and an array of points.
77
* @method _getLabelData
78
* @param {Object} startPoint An object containing x and y values.
79
* @param {Number} edgeOffset Distance to offset coordinates.
80
* @param {Number} layoutLength Distance that the axis spans.
81
* @param {Number} count Number of labels.
82
* @param {String} direction Indicates whether the axis is horizontal or vertical.
83
* @param {Array} Array containing values for axis labels.
87
_getLabelData: function(constantVal, staticCoord, dynamicCoord, min, max, edgeOffset, layoutLength, count, dataValues)
95
data = this.get("data"),
97
dataValues = dataValues || data;
98
for(i = 0; i < count; i = i + 1)
100
labelValue = dataValues[i];
101
labelIndex = Y.Array.indexOf(data, labelValue);
102
if(Y_Lang.isNumber(labelIndex) && labelIndex > -1)
105
point[staticCoord] = constantVal;
106
point[dynamicCoord] = this._getCoordFromValue(
114
values.push(labelValue);
126
}, '3.13.0', {"requires": ["axis", "axis-category-base"]});