NumericImpl Class
NumericImpl contains logic for numeric data. NumericImpl is used by the following classes: <ul> <li>NumericAxisBase</li> <li>NumericAxis</li> </ul>
Constructor
NumericImpl
()
Index
Methods
Properties
Attributes
Methods
_getCoordFromValue
-
min
-
max
-
length
-
dataValue
-
offset
-
reverse
Returns a coordinate corresponding to a data values.
Parameters:
-
min
Number<p><p>The minimum for the axis.</p></p>
-
max
Number<p><p>The maximum for the axis.</p></p>
-
length
Number<p><p>The distance that the axis spans.</p></p>
-
dataValue
Number<p><p>A value used to ascertain the coordinate.</p></p>
-
offset
Number<p><p>Value in which to offset the coordinates.</p></p>
-
reverse
Boolean<p><p>Indicates whether the coordinates should start from the end of an axis. Only used in the numeric implementation.</p></p>
Returns:
<p><p>Number</p></p>
_getMinimumUnit
-
max
-
min
-
units
Helper method for getting a roundingUnit
when calculating the minimum and maximum values.
Parameters:
Returns:
<p><p>Number</p></p>
_getNiceNumber
-
roundingUnit
Calculates a nice rounding unit based on the range.
Parameters:
-
roundingUnit
Number<p><p>The calculated rounding unit.</p></p>
Returns:
<p><p>Number</p></p>
_roundDownToNearest
-
number
-
nearest
Rounds a Number down 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().
Parameters:
Returns:
<p><p>Number</p></p>
_roundMinAndMax
-
min
-
max
Rounds the mimimum and maximum values based on the roundingUnit
attribute.
_roundToNearest
-
number
-
nearest
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().
Parameters:
Returns:
<p><p>Number</p></p>
_roundToPrecision
-
number
-
precision
Rounds a number to a certain level of precision. Useful for limiting the number of decimal places on a fractional number.
Parameters:
Returns:
<p><p>Number</p></p>
_roundUpToNearest
-
number
-
nearest
Rounds a Number up 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().
Parameters:
Returns:
<p><p>Number</p></p>
-
value
-
format
Formats a label based on the axis type and optionally specified format.
Parameters:
-
value
Object -
format
Object<p><p>Pattern used to format the value.</p></p>
Returns:
<p><p>String</p></p>
_updateMinAndMax
()
private
Calculates the maximum and minimum values for the Data
.
getOrigin
()
Returns the value corresponding to the origin on the axis.
Returns:
<p><p>Number</p></p>
getTotalByKey
-
key
Returns the sum of all values per key.
Parameters:
-
key
String<p><p>The identifier for the array whose values will be calculated.</p></p>
Returns:
<p><p>Number</p></p>
initializer
()
private
Properties
_type
Unknown
private
Type of data used in Data
.
Attributes
labelFunction
Function
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 Data' appendLabelFunction
to accept html as a String
.
<dl>
<dt>val</dt><dd>Label to be formatted. (String
)</dd>
<dt>format</dt><dd>Object containing properties used to format the label. (optional)</dd>
</dl>
roundingMethod
String
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>
Default: niceNumber