NumericAxis.js revision 8648721e29bb657dd5c5ff20f03e86fe50628ce6
/**
* NumericAxis manages numeric data on an axis.
*
* @param {Object} config (optional) Configuration parameters for the Chart.
* @class NumericAxis
* @constructor
* @extends AxisType
*/
function NumericAxis(config)
{
}
NumericAxis.ATTRS = {
/**
* Indicates whether 0 should always be displayed.
*
* @attribute alwaysShowZero
* @type Boolean
*/
value: true
},
/**
* Formats a label.
*
* @attribute labelFunction
* @type Function
* @param {Object} val Value to be formatted.
* @param {Object} format Hasho of properties used to format the label.
*/
{
if(format)
{
}
return val;
}
},
/**
* Hash of properties used by the <code>labelFunction</code> to format a
* label.
*
* @attribute labelFormat
* @type Object
*/
labelFormat: {
value: {
prefix: "",
thousandsSeparator: "",
decimalSeparator: "",
decimalPlaces: "0",
suffix: ""
}
}
};
{
/**
* @private
*/
_type: "numeric",
/**
* @private
*/
{
},
/**
* @private
*/
_getNiceNumber: function(roundingUnit)
{
var tempMajorUnit = roundingUnit,
{
}
else
{
}
if(!isNaN(tempMajorUnit))
{
return tempMajorUnit;
}
return roundingUnit;
},
/**
* @private
*/
_updateMinAndMax: function()
{
max = 0,
min = 0,
len,
num,
i,
key,
{
{
if(len > 1)
{
for(i = 1; i < len; i++)
{
{
{
//hloc values
{
{
}
}
}
continue;
}
}
}
}
}
},
/**
* @private
*/
{
var roundingUnit,
if(roundingMethod)
{
if(roundingMethod == "niceNumber")
{
{
{
min = 0;
}
}
else if(maxGreaterThanZero && !minGreaterThanZero)
{
}
else
{
{
max = 0;
}
else
{
}
}
}
else if(roundingMethod == "auto")
{
{
{
min = 0;
}
if(useIntegers)
{
}
}
else if(maxGreaterThanZero && !minGreaterThanZero)
{
if(alwaysShowZero)
{
if(useIntegers)
{
}
else
{
}
}
else
{
if(useIntegers)
{
}
}
}
else
{
if(useIntegers)
{
}
{
max = 0;
if(useIntegers)
{
Math.ceil(roundingUnit);
}
}
else
{
}
}
}
{
{
{
min = 0;
}
else
{
}
if(!dataRangeGreater)
{
}
else
{
}
}
else if(maxGreaterThanZero && !minGreaterThanZero)
{
if(!dataRangeGreater)
{
}
else
{
}
}
else
{
{
max = 0;
}
else
{
}
if(!dataRangeGreater)
{
}
else
{
}
}
}
}
this._dataMaximum = max;
this._dataMinimum = min;
},
/**
* 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.
*/
getLabelByIndex: function(i, l)
{
l -= 1;
if(i > 0)
{
}
return label;
},
/**
* @private
*
* Rounds a Number to the nearest multiple of an input. For example, by rounding
* 16 to the nearest 10, you will receive 20. Similar to the built-in function Math.round().
*/
{
if(nearest === 0)
{
return number;
}
},
/**
* @private
*
* Rounds a Number <em>up</em> to the nearest multiple of an input. For example, by rounding
* 16 up to the nearest 10, you will receive 20. Similar to the built-in function Math.ceil().
*/
{
if(nearest === 0)
{
return number;
}
},
/**
* @private
*
* Rounds a Number <em>down</em> to the nearest multiple of an input. For example, by rounding
* 16 down to the nearest 10, you will receive 10. Similar to the built-in function Math.floor().
*/
{
if(nearest === 0)
{
return number;
}
},
/**
* @private
*
* Rounds a number to a certain level of precision. Useful for limiting the number of
* decimal places on a fractional number.
*/
{
}
});
Y.NumericAxis = NumericAxis;