/**
* AxisType is an abstract class that manages the data for an axis.
*
* @module charts
* @class AxisType
* @constructor
* @extends Axis
*/
/**
* @method initializer
* @private
*/
initializer: function()
{
},
/**
* @method bindUI
* @private
*/
bindUI: function()
{
},
/**
* Handles changes to `dataProvider`.
*
* @method _dataProviderChangeHandler
* @param {Object} e Event object.
* @private
*/
_dataProviderChangeHandler: function(e)
{
i;
if(keys)
{
for(i in keys)
{
if(keys.hasOwnProperty(i))
{
delete keys[i];
}
}
}
{
}
},
/**
* Constant used to generate unique id.
*
* @property GUID
* @type String
* @private
*/
GUID: "yuibaseaxis",
/**
* Type of data used in `Axis`.
*
* @property _type
* @type String
* @readOnly
* @private
*/
_type: null,
/**
* Storage for `setMaximum` attribute.
*
* @property _setMaximum
* @type Object
* @private
*/
_setMaximum: null,
/**
* Storage for `dataMaximum` attribute.
*
* @property _dataMaximum
* @type Object
* @private
*/
_dataMaximum: null,
/**
* Storage for `setMinimum` attribute.
*
* @property _setMinimum
* @type Object
* @private
*/
_setMinimum: null,
/**
* Reference to data array.
*
* @property _data
* @type Array
* @private
*/
_data: null,
/**
* Indicates whether the all data is up to date.
*
* @property _updateTotalDataFlag
* @type Boolean
* @private
*/
_updateTotalDataFlag: true,
/**
* Storage for `dataReady` attribute.
*
* @property _dataReady
* @type Boolean
* @readOnly
* @private
*/
_dataReady: false,
/**
* Adds an array to the key hash.
*
* @method addKey
* @param value Indicates what key to use in retrieving
* the array.
*/
{
},
/**
* 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 i = 0,
obj,
keyArray = [],
for(; i < len; ++i)
{
}
return keyArray;
},
/**
* Sets data by key
*
* @method _setDataByKey
* @param {String} key Key value to use.
* @param {Array} data Array to use.
* @private
*/
{
var i,
obj,
arr = [],
for(i = 0; i < len; ++i)
{
}
this._updateTotalDataFlag = true;
},
/**
* Updates the total data array.
*
* @method _updateTotalData
* @private
*/
_updateTotalData: function()
{
i;
this._data = [];
for(i in keys)
{
if(keys.hasOwnProperty(i))
{
}
}
this._updateTotalDataFlag = false;
},
/**
* Removes an array from the key hash.
*
* @method removeKey
* @param {String} value Indicates what key to use in removing from
* the hash.
*/
{
{
this._keyChangeHandler();
}
},
/**
* Returns a value based of a key value and an index.
*
* @method getKeyValueAt
* @param {String} key value used to look up the correct array
* @param {Number} index within the array
* @return Number
*/
{
{
}
return parseFloat(value);
},
/**
* Returns an array of values based on an identifier key.
*
* @method getDataByKey
* @param {String} value value used to identify the array
* @return Object
*/
getDataByKey: function (value)
{
{
}
return null;
},
/**
* Calculates the maximum and minimum values for the `Axis`.
*
* @method _updateMinAndMax
* @private
*/
_updateMinAndMax: function()
{
max = 0,
min = 0,
len,
num,
i;
{
if(len > 1)
{
for(i = 1; i < len; i++)
{
{
continue;
}
}
}
}
this._dataMaximum = max;
this._dataMinimum = min;
},
/**
* Returns the total number of majorUnits that will appear on an axis.
*
* @method getTotalMajorUnits
* @return Number
*/
getTotalMajorUnits: function()
{
var units,
{
}
{
}
return units;
},
/**
* Returns the distance between major units on an axis.
*
* @method getMajorUnitDistance
* @param {Number} len Number of ticks
* @param {Number} uiLen Size of the axis.
* @param {Object} majorUnit Hash of properties used to determine the majorUnit
* @return Number
*/
{
var dist;
{
}
{
}
return dist;
},
/**
* Gets the distance that the first and last ticks are offset from there respective
* edges.
*
* @method getEdgeOffset
* @param {Number} ct Number of ticks on the axis.
* @param {Number} l Length (in pixels) of the axis.
* @return Number
*/
getEdgeOffset: function(ct, l)
{
return 0;
},
/**
* 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;
return label;
},
/**
* Updates the `Axis` after a change in keys.
*
* @method _keyChangeHandler
* @param {Object} e Event object.
* @private
*/
_keyChangeHandler: function(e)
{
this._updateMinAndMax();
this.fire("dataUpdate");
},
/**
* Checks to see if data extends beyond the range of the axis. If so,
* that data will need to be hidden. This method is internal, temporary and subject
* to removal in the future.
*
* @method _hasDataOverflow
* @protected
* @return Boolean
*/
_hasDataOverflow: function()
{
{
return true;
}
return false;
},
/**
* Returns a string corresponding to the first label on an
* axis.
*
* @method getMinimumValue
* @return String
*/
getMinimumValue: function()
{
return this.get("minimum");
},
/**
* Returns a string corresponding to the last label on an
* axis.
*
* @method getMaximumValue
* @return String
*/
getMaximumValue: function()
{
return this.get("maximum");
}
}, {
ATTRS: {
/**
* Hash of array identifed by a string value.
*
* @attribute keys
* @type Object
*/
keys: {
value: {},
{
var keys = {},
i,
len,
{
for(i = 0; i < len; ++i)
{
}
}
{
}
else
{
for(i in val)
{
if(val.hasOwnProperty(i))
{
}
}
}
this._updateTotalDataFlag = true;
return keys;
}
},
/**
*Indicates how to round unit values.
* <dl>
* <dt>niceNumber</dt><dd>Units will be smoothed based on the number of ticks and data range.</dd>
* <dt>auto</dt><dd>If the range is greater than 1, the units will be rounded.</dd>
* <dt>numeric value</dt><dd>Units will be equal to the numeric value.</dd>
* <dt>null</dt><dd>No rounding will occur.</dd>
* </dl>
*
* @attribute roundingMethod
* @type String
* @default niceNumber
*/
value: "niceNumber"
},
/**
*Returns the type of axis data
* <dl>
* <dt>time</dt><dd>Manages time data</dd>
* <dt>stacked</dt><dd>Manages stacked numeric data</dd>
* <dt>numeric</dt><dd>Manages numeric data</dd>
* <dt>category</dt><dd>Manages categorical data</dd>
* </dl>
*
* @attribute type
* @type String
*/
type:
{
readOnly: true,
getter: function ()
{
return this._type;
}
},
/**
* Instance of `ChartDataProvider` that the class uses
* to build its own data.
*
* @attribute dataProvider
* @type Array
*/
{
return value;
}
},
/**
* The maximum value contained in the `data` array. Used for
* `maximum` when `autoMax` is true.
*
* @attribute dataMaximum
* @type Number
*/
dataMaximum: {
getter: function ()
{
if(!this._dataMaximum)
{
this._updateMinAndMax();
}
return this._dataMaximum;
}
},
/**
* The maximum value that will appear on an axis.
*
* @attribute maximum
* @type Number
*/
maximum: {
lazyAdd: false,
getter: function ()
{
//If all values are zero, force a range so that the Axis and related series
//will still render.
{
max = 10;
}
{
max = this._setMaximum;
}
return parseFloat(max);
},
{
return value;
}
},
/**
* The minimum value contained in the `data` array. Used for
* `minimum` when `autoMin` is true.
*
* @attribute dataMinimum
* @type Number
*/
dataMinimum: {
getter: function ()
{
if(!this._dataMinimum)
{
this._updateMinAndMax();
}
return this._dataMinimum;
}
},
/**
* The minimum value that will appear on an axis.
*
* @attribute minimum
* @type Number
*/
minimum: {
lazyAdd: false,
getter: function ()
{
{
min = this._setMinimum;
}
return parseFloat(min);
},
{
return val;
}
},
/**
* Determines whether the maximum is calculated or explicitly
* set by the user.
*
* @attribute setMax
* @type Boolean
*/
setMax: {
readOnly: true,
getter: function()
{
}
},
/**
* Determines whether the minimum is calculated or explicitly
* set by the user.
*
* @attribute setMin
* @type Boolean
*/
setMin: {
readOnly: true,
getter: function()
{
}
},
/**
* Array of axis data
*
* @attribute data
* @type Array
*/
data: {
getter: function ()
{
if(!this._data || this._updateTotalDataFlag)
{
this._updateTotalData();
}
return this._data;
}
},
/**
* Array containing all the keys in the axis.
* @attribute keyCollection
* @type Array
*/
getter: function()
{
i,
col = [];
for(i in keys)
{
if(keys.hasOwnProperty(i))
{
}
}
return col;
},
readOnly: true
}
}
});