BaseAxis.js revision 106cc795c2891f2d2d142772cadefbcb5975bcfa
/**
* BaseAxis is the base class for observable baseAxis classes.
*/
/**
* Creates the BaseAxis instance and contains initialization data
*
* @param {Object} config (optional) Configuration parameters for the Chart.
* @class SWFWidget
* @constructor
*/
{
this._createId();
this._keys = {};
this._data = [];
}
/**
* Attribute config
* @private
*/
/**
* Parent element for the BaseAxis instance.
*/
parent:{
lazyAdd:false,
value:null
},
/**
* @private
* Storage for rounding unit
*/
getter: function ()
{
return this._roundingUnit;
},
{
this._roundingUnit = val;
if(this._roundMinAndMax)
{
this._updateMinAndMax();
}
return val;
}
},
/**
* Indicates whether or not to round values when calculating
* <code>maximum</code> and <code>minimum</code>.
*/
getter: function ()
{
return this._roundMinAndMax;
},
{
if(this._roundMinAndMax == val)
{
return val;
}
this._roundMinAndMax = val;
this._updateMinAndMax();
}
},
/**
* Returns the type of axis data
* <ul>
* <li><code>time</code></li>
* <li><code>numeric</code></li>
* <li><code>category</code></li>
* </ul>
*/
{
getter: function ()
{
return this._dataType;
}
},
/**
* Instance of <code>ChartDataProvider</code> that the class uses
* to build its own data.
*/
getter: function ()
{
return this._dataProvider;
},
{
if(value === this._dataProvider)
{
return;
}
if(this._dataProvider)
{
//remove listeners
}
return value;
},
lazyAdd: false
},
/**
* The maximum value contained in the <code>data</code> array. Used for
* <code>maximum</code> when <code>autoMax</code> is true.
*/
dataMaximum: {
getter: function ()
{
return this._dataMaximum;
}
},
/**
* The maximum value that will appear on an axis.
*/
maximum: {
getter: function ()
{
if(this._autoMax || !this._setMaximum)
{
return this._dataMaximum;
}
return this._setMaximum;
},
{
this._setMaximum = value;
}
},
/**
* The minimum value contained in the <code>data</code> array. Used for
* <code>minimum</code> when <code>autoMin</code> is true.
*/
dataMinimum: {
getter: function ()
{
return this._dataMinimum;
}
},
/**
* The minimum value that will appear on an axis.
*/
minimum: {
getter: function ()
{
if(this._autoMin || !this._setMinimum)
{
return this._dataMinimum;
}
return this._setMinimum;
},
{
this._setMinimum = val;
return val;
}
},
/**
* Determines whether the maximum is calculated or explicitly
* set by the user.
*/
autoMax: {
getter: function ()
{
return this._autoMax;
},
{
}
},
/**
* Determines whether the minimum is calculated or explicitly
* set by the user.
*/
autoMin: {
getter: function ()
{
return this._autoMin;
},
{
}
},
/**
* Array of axis data
*/
data: {
getter: function ()
{
return this._data;
}
},
/**
* Hash of array identifed by a string value.
*/
keys: {
getter: function ()
{
return this._keys;
}
}
};
{
/**
* Creates unique id for class instance.
*
* @private
*/
_createId: function()
{
},
/**
* @private
* Storaga for roundingUnit
*/
/**
* @private
* Storage for round min and max
*/
_roundMinAndMax: true,
/**
* @private
* Storage for dataType
*/
_dataType: null,
/**
* @private
* Storage for dataProvider
*/
_dataProvider: null,
/**
* @private
* Instance copy of the ChartDataProvider's data array.
*/
_dataClone: null,
/**
* @private
* Storage for maximum when autoMax is false.
*/
_setMaximum: null,
/**
* @private
* Storage for dataMaximum
* is true.
*/
_dataMaximum: null,
/**
* @private
* Storage for autoMax
*/
_autoMax: true,
/**
* @private
* Storage for minimum when autoMin is false.
*/
_setMinimum: null,
/**
* @private
* Storage for dataMinimum.
*/
_dataMinimum: null,
/**
* @private
* Storage for autoMin.
*/
_autoMin: true,
/**
* @private
* Storage for data
*/
_data: null,
/**
* @private
* Storage for keys
*/
_keys: null,
/**
* @private
* Indicates that the axis has a data source and at least one
* key.
*/
_axisReady: false,
/**
* Adds an array to the key hash.
*
* @param value Indicates what key to use in retrieving
* the array.
*/
{
{
return;
}
eventKeys = {},
this._setDataByKey(value);
this._updateMinAndMax();
if(!this._dataReady)
{
this._dataReady = true;
}
else
{
}
},
/**
* @private
*
* Creates an array of data based on a key value.
*/
_setDataByKey: function(key)
{
var i,
obj,
arr = [],
for(i = 0; i < len; ++i)
{
}
},
/**
* Removes an array from the key hash.
*
* @param value Indicates what key to use in removing from
* the hash.
* @return Boolean
*/
{
{
return;
}
var key,
newKeys = {},
newData = [],
removedKeys = {},
event = {};
{
{
{
continue;
}
}
}
this._updateMinAndMax();
},
/**
* Returns a numeric value based of a key value and an index.
*/
{
{
}
return value;
},
/**
* Returns an array of values based on an identifier key.
*/
getDataByKey: function (value)
{
{
}
return null;
},
/**
* @private
* Updates the <code>dataMaximum</code> and <code>dataMinimum</code> values.
*/
_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;
},
/**
* @private
* Handles updates axis data properties based on the <code>DataEvent.NEW_DATA</code>
* event from the <code>dataProvider</code>.
*/
newDataUpdateHandler: function()
{
var i,
event = {};
this._data = [];
for(i in keys)
{
if(keys.hasOwnProperty(i))
{
keys[i] = this._setDataByKey(i);
}
}
this._updateMinAndMax();
},
/**
* @private
* Updates axis data properties based on the <code>DataEvent.DATA_CHANGE</code>
* event from the <code>dataProvider</code>.
*/
_keyDataUpdateHandler: function ()
{
var hasKey = false,
event = {},
for(var i in keys)
{
if(keys.hasOwnProperty(i))
{
if(keysAdded.hasOwnProperty(i))
{
hasKey = true;
}
if(keysRemoved.hasOwnProperty(i))
{
hasKey = true;
keys[i] = [];
}
}
}
if(!hasKey)
{
return;
}
this._data = [];
for(i in keys)
{
if(keys.hasOwnProperty(i))
{
}
}
this._updateMinAndMax();
}
});