TimeAxis.js revision e03e2775537690229fec4bc156e946f851d2cdfd
/**
* TimeAxis manages time data on an axis.
*
* @module charts
* @class TimeAxis
* @constructor
* @param {Object} config (optional) Configuration parameters for the Chart.
* @extends AxisType
*/
{
}
{
/**
* Indicates whether the maximum is calculated or explicitly set.
*
* @attribute setMax
* @readOnly
* @type Boolean
* @private
*/
setMax: {
readOnly: true,
getter: function()
{
}
},
/**
* Indicates whether the minimum is calculated or explicitly set.
*
* @attribute setMin
* @readOnly
* @type Boolean
* @private
*/
setMin: {
readOnly: true,
getter: function()
{
}
},
/**
* The maximum value that will appear on an axis. Unless explicitly set, this value is calculated by the `Axis`.
*
* @attribute maximum
* @type Number
*/
maximum: {
getter: function ()
{
{
}
return parseFloat(max);
},
{
return value;
}
},
/**
* The minimum value that will appear on an axis. Unless explicitly set, this value is calculated by the `Axis`.
*
* @attribute minimum
* @type Number
*/
minimum: {
getter: function ()
{
{
}
return parseFloat(min);
},
{
return value;
}
},
/**
* Method used for formatting a label. This attribute allows for the default label formatting method to overridden. The method use would need
* to implement the arguments below and return a `String` or an `HTMLElement`. The default implementation of the method returns a `String`. The output of this method
* will be rendered to the DOM using `appendChild`. If you override the `labelFunction` method and return an html string, you will also need to override the Axis'
* `appendLabelFunction` to accept html as a `String`.
* <dl>
* <dt>val</dt><dd>Label to be formatted. (`String`)</dd>
* <dt>format</dt><dd>STRFTime string used to format the label. (optional)</dd>
* </dl>
*
* @attribute labelFunction
* @type Function
*/
{
}
},
/**
* Pattern used by the `labelFunction` to format a label.
*
* @attribute labelFormat
* @type String
*/
labelFormat: {
value: "%b %d, %y"
}
};
/**
* Formats a label based on the axis type and optionally specified format.
*
* @method formatLabel
* @param {Object} value
* @param {Object} format Pattern used to format the value.
* @return String
*/
{
if(format)
{
}
return val;
},
/**
* Constant used to generate unique id.
*
* @property GUID
* @type String
* @private
*/
GUID: "yuitimeaxis",
/**
* Type of data used in `Axis`.
*
* @property _dataType
* @readOnly
* @private
*/
_dataType: "time",
/**
* Calculates and returns a value based on the number of labels and the index of
* the current label.
*
* @method getLabelByIndex
* @param {Number} i Index of the label.
* @param {Number} l Total number of labels.
* @return String
*/
getLabelByIndex: function(i, l)
{
l -= 1;
{
}
else
{
}
return label;
},
/**
* Gets an array of values based on a key.
*
* @method _getKeyArray
* @param {String} key Value key associated with the data array.
* @param {Array} data Array in which the data resides.
* @return Array
* @private
*/
{
var obj,
keyArray = [],
i = 0,
val,
for(; i < len; ++i)
{
{
}
else
{
{
}
{
{
}
else
{
if(typeof obj != "string")
{
}
}
}
else
{
}
}
}
return keyArray;
},
/**
* Sets data by key
*
* @method _setDataByKey
* @param {String} key Key value to use.
* @param {Array} data Array to use.
* @private
*/
{
var obj,
arr = [],
i,
val,
for(i = 0; i < len; ++i)
{
{
}
else
{
{
}
{
{
}
else
{
if(typeof obj != "string")
{
}
}
}
else
{
}
}
}
this._updateTotalDataFlag = true;
},
/**
* Parses value into a number.
*
* @method _getNumber
* @param val {Object} Value to parse into a number
* @return Number
* @private
*/
_getNumber: function(val)
{
{
}
{
}
return val;
}
});