#

API Docs for:
Show: Inherited Protected Private Deprecated

# NumericAxis Class

Defined in: `input/charts/NumericAxis.js:1`
Module: charts

NumericAxis manages numeric data on an axis.

- Index
- Methods
- Properties
- Attributes

## Item Index

### Methods

- _getMinimumUnit
- _getNiceNumber
- _hasDataOverflow
- _roundDownToNearest
- _roundMinAndMax
- _roundToNearest
- _roundToPrecision
- _roundUpToNearest
- _updateMinAndMax
- formatLabel
- getLabelByIndex
- getTotalByKey

### Properties

- _type

### Attributes

- alwaysShowZero
- labelFormat
- labelFunction

## Methods

### `_getMinimumUnit`

(

- `max`
- `min`
- `units`

)
private

Defined in `input/charts/NumericAxis.js:123`

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

#### Parameters:

- `max` Number

  Maximum number

- `min` Number

  Minimum number

- `units` Number

  Number of units on the axis

#### Returns:

Number

### `_getNiceNumber`

(

- `roundingUnit`

)
private

Defined in `input/charts/NumericAxis.js:138`

Calculates a nice rounding unit based on the range.

#### Parameters:

- `roundingUnit` Number

  The calculated rounding unit.

#### Returns:

Number

### `_hasDataOverflow`

() protected

Defined in `input/charts/NumericAxis.js:651`

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.

#### Returns:

Boolean

### `_roundDownToNearest`

(

- `number`
- `nearest`

)
private

Defined in `input/charts/NumericAxis.js:614`

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

  Number to round

- `nearest` Number

  Multiple to round towards.

#### Returns:

Number

### `_roundMinAndMax`

(

- `min`
- `max`

)
private

Defined in `input/charts/NumericAxis.js:248`

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

#### Parameters:

- `min` Number

  Minimum value

- `max` Number

  Maximum value

### `_roundToNearest`

(

- `number`
- `nearest`

)
private

Defined in `input/charts/NumericAxis.js:573`

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

  Number to round

- `nearest` Number

  Multiple to round towards.

#### Returns:

Number

### `_roundToPrecision`

(

- `number`
- `precision`

)
private

Defined in `input/charts/NumericAxis.js:634`

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

#### Parameters:

- `number` Number

  Number to round

- `precision` Number

  Multiple to round towards.

#### Returns:

Number

### `_roundUpToNearest`

(

- `number`
- `nearest`

)
private

Defined in `input/charts/NumericAxis.js:594`

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

  Number to round

- `nearest` Number

  Multiple to round towards.

#### Returns:

Number

### `_updateMinAndMax`

() private

Defined in `input/charts/NumericAxis.js:170`

Calculates the maximum and minimum values for the `Axis`.

### `formatLabel`

(

- `value`
- `format`

)

Defined in `input/charts/NumericAxis.js:72`

Formats a label based on the axis type and optionally specified format.

#### Parameters:

- `value` Object
- `format` Object

  Pattern used to format the value.

#### Returns:

String

### `getLabelByIndex`

(

- `i`
- `l`

)

Defined in `input/charts/NumericAxis.js:535`

Calculates and returns a value based on the number of labels and the index of the current label.

#### Parameters:

- `i` Number

  Index of the label.

- `l` Number

  Total number of labels.

#### Returns:

String

### `getTotalByKey`

(

- `key`

)

Defined in `input/charts/NumericAxis.js:89`

Returns the sum of all values per key.

#### Parameters:

- `key` String

  The identifier for the array whose values will be calculated.

#### Returns:

Number

## Properties

### `_type`

Unknown private

Defined in `input/charts/NumericAxis.js:114`

Type of data used in `Axis`.

## Attributes

### `alwaysShowZero`

Boolean

Defined in `input/charts/NumericAxis.js:18`

Indicates whether 0 should always be displayed.

### `labelFormat`

Object

Defined in `input/charts/NumericAxis.js:52`

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

### `labelFunction`

Function

Defined in `input/charts/NumericAxis.js:28`

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 Axis' `appendLabelFunction` to accept html as a `String`.

val
  Label to be formatted. (`String`)
format
  Object containing properties used to format the label. (optional)