Show:
Module: axis-numeric-base
Parent Module: charts

NumericImpl contains logic for numeric data. NumericImpl is used by the following classes: <ul> <li>NumericAxisBase</li> <li>NumericAxis</li> </ul>

Constructor

NumericImpl

()

Methods

_getCoordFromValue

(
  • min
  • max
  • length
  • dataValue
  • offset
  • reverse
)
private

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
)
private

Helper method for getting a roundingUnit when calculating the minimum and maximum values.

Parameters:

  • max Number

    <p><p>Maximum number</p></p>

  • min Number

    <p><p>Minimum number</p></p>

  • units Number

    <p><p>Number of units on the axis</p></p>

Returns:

<p><p>Number</p></p>

_getNiceNumber

(
  • roundingUnit
)
private

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
)
private

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:

  • number Number

    <p><p>Number to round</p></p>

  • nearest Number

    <p><p>Multiple to round towards.</p></p>

Returns:

<p><p>Number</p></p>

_roundMinAndMax

(
  • min
  • max
)
private

Rounds the mimimum and maximum values based on the roundingUnit attribute.

Parameters:

  • min Number

    <p><p>Minimum value</p></p>

  • max Number

    <p><p>Maximum value</p></p>

_roundToNearest

(
  • number
  • nearest
)
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().

Parameters:

  • number Number

    <p><p>Number to round</p></p>

  • nearest Number

    <p><p>Multiple to round towards.</p></p>

Returns:

<p><p>Number</p></p>

_roundToPrecision

(
  • number
  • precision
)
private

Rounds a number to a certain level of precision. Useful for limiting the number of decimal places on a fractional number.

Parameters:

  • number Number

    <p><p>Number to round</p></p>

  • precision Number

    <p><p>Multiple to round towards.</p></p>

Returns:

<p><p>Number</p></p>

_roundUpToNearest

(
  • number
  • nearest
)
private

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:

  • number Number

    <p><p>Number to round</p></p>

  • nearest Number

    <p><p>Multiple to round towards.</p></p>

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

alwaysShowZero

Boolean

Indicates whether 0 should always be displayed.

labelFormat

Object

Object containing properties used by the labelFunction to format a label.

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

String

Indicates the scaling for the chart. The default value is linear. For a logarithmic axis, set the value to logarithmic.

Default: linear