#

API Docs for: 3.10.3
Show: Inherited Protected Private Deprecated

# CategoryImpl Class

Defined in: `charts/js/CategoryImpl.js:8`
Module: axis-category-base
Parent Module: charts

CategoryImpl contains logic for managing category data. CategoryImpl is used by the following classes:

- CategoryAxisBase
- CategoryAxis

## Constructor

### `CategoryImpl`

()

Defined in `charts/js/CategoryImpl.js:8`

- Index
- Methods
- Properties
- Attributes

## Item Index

### Methods

- _getKeyArray
- _updateMinAndMax
- formatLabel
- getDataByKey
- getKeyValueAt
- getTotalMajorUnits

### Properties

- _dataType
- _indices
- GUID

### Attributes

- calculateEdgeOffset
- labelFunction

## Methods

### `_getKeyArray`

(

- `key`
- `data`

)
private

Defined in `charts/js/CategoryImpl.js:100`

Gets an array of values based on a key.

#### Parameters:

- `key` String

  Value key associated with the data array.

- `data` Array

  Array in which the data resides.

#### Returns:

Array

### `_updateMinAndMax`

() private

Defined in `charts/js/CategoryImpl.js:88`

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

### `formatLabel`

(

- `value`

)

Defined in `charts/js/CategoryImpl.js:50`

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

#### Parameters:

- `value` Object

#### Returns:

String

### `getDataByKey`

(

- `value`

)

Defined in `charts/js/CategoryImpl.js:130`

Returns an array of values based on an identifier key.

#### Parameters:

- `value` String

  value used to identify the array

#### Returns:

Array

### `getKeyValueAt`

(

- `key`
- `index`

)

Defined in `charts/js/CategoryImpl.js:164`

Returns a value based of a key value and an index.

#### Parameters:

- `key` String

  value used to look up the correct array

- `index` Number

  within the array

#### Returns:

String

### `getTotalMajorUnits`

(

- `majorUnit`
- `len`

)

Defined in `charts/js/CategoryImpl.js:151`

Returns the total number of majorUnits that will appear on an axis.

#### Parameters:

- `majorUnit` Object

  Object containing properties related to the majorUnit.

- `len` Number

  Length of the axis.

#### Returns:

Number

## Properties

### `_dataType`

Unknown private

Defined in `charts/js/CategoryImpl.js:79`

Type of data used in `Data`.

### `_indices`

Unknown private

Defined in `charts/js/CategoryImpl.js:62`

Object storing key data.

### `GUID`

String private

Defined in `charts/js/CategoryImpl.js:70`

Constant used to generate unique id.

## Attributes

### `calculateEdgeOffset`

Boolean

Defined in `charts/js/CategoryImpl.js:26`

Determines whether and offset is automatically calculated for the edges of the axis.

#### Fires event `calculateEdgeOffsetChange`

Fires when the value for the configuration attribute `calculateEdgeOffset` is changed. You can listen for the event using the `on` method if you wish to be notified before the attribute's value has changed, or using the `after` method if you wish to be notified after the attribute's value has changed.

#### Parameters:

- `e` EventFacade
  An Event Facade object with the following attribute-specific properties added:
  - `prevVal` Any
    The value of the attribute, prior to it being set.
  - `newVal` Any
    The value the attribute is to be set to.
  - `attrName` String
    The name of the attribute being set.
  - `subAttrName` String
    If setting a property within the attribute's value, the name of the sub-attribute property being set.

### `labelFunction`

Function

Defined in `charts/js/CategoryImpl.js:36`

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 `HTMLElement`.

val
  Label to be formatted. (`String`)
format
  Template for formatting label. (optional)

#### Fires event `labelFunctionChange`

Fires when the value for the configuration attribute `labelFunction` is changed. You can listen for the event using the `on` method if you wish to be notified before the attribute's value has changed, or using the `after` method if you wish to be notified after the attribute's value has changed.

#### Parameters:

- `e` EventFacade
  An Event Facade object with the following attribute-specific properties added:
  - `prevVal` Any
    The value of the attribute, prior to it being set.
  - `newVal` Any
    The value the attribute is to be set to.
  - `attrName` String
    The name of the attribute being set.
  - `subAttrName` String
    If setting a property within the attribute's value, the name of the sub-attribute property being set.