Class: DatasetController | Chart.js
Description: Open source HTML5 Charts for your website

# # Class: DatasetController<TType, TElement, TDatasetElement, TParsedData>

## # Type parameters

Name | Type
--- | ---
`TType` | extends `ChartType` = `ChartType`
`TElement` | extends `Element` = `Element`
`TDatasetElement` | extends `Element` = `Element`
`TParsedData` | `ParsedDataType`<`TType`>

## # Hierarchy

- `DatasetController`

  ↳ `DoughnutController`

## # Constructors

### # constructor

• new DatasetController<`TType`, `TElement`, `TDatasetElement`, `TParsedData`>(`chart`, `datasetIndex`)

#### # Type parameters

Name | Type
--- | ---
`TType` | extends keyof `ChartTypeRegistry` = keyof `ChartTypeRegistry`
`TElement` | extends `Element`<`AnyObject`, `AnyObject`, `TElement`> = `Element`<`AnyObject`, `AnyObject`>
`TDatasetElement` | extends `Element`<`AnyObject`, `AnyObject`, `TDatasetElement`> = `Element`<`AnyObject`, `AnyObject`>
`TParsedData` | `ParsedDataType`<`TType`>

#### # Parameters

Name | Type
--- | ---
`chart` | `Chart`<keyof `ChartTypeRegistry`, (`number` | `ScatterDataPoint` | `BubbleDataPoint`)[], `unknown`>
`datasetIndex` | `number`

#### # Defined in

index.esm.d.ts:579
(opens new window)

## # Properties

### # _cachedMeta

• `Readonly` _cachedMeta: `ChartMeta`<`TElement`, `TDatasetElement`, `TType`>

#### # Defined in

index.esm.d.ts:583
(opens new window)

### # chart

• `Readonly` chart: `Chart`<keyof `ChartTypeRegistry`, (`number` | `ScatterDataPoint` | `BubbleDataPoint`)[], `unknown`>

#### # Defined in

index.esm.d.ts:581
(opens new window)

### # enableOptionSharing

• enableOptionSharing: `boolean`

#### # Defined in

index.esm.d.ts:584
(opens new window)

### # index

• `Readonly` index: `number`

#### # Defined in

index.esm.d.ts:582
(opens new window)

### # supportsDecimation

• supportsDecimation: `boolean`

#### # Defined in

index.esm.d.ts:588
(opens new window)

## # Methods

### # addElements

▸ addElements(): `void`

#### # Returns

`void`

#### # Defined in

index.esm.d.ts:604
(opens new window)

### # applyStack

▸ `Protected` applyStack(`scale`, `parsed`): `number`

#### # Parameters

Name | Type
--- | ---
`scale` | `Scale`<`CoreScaleOptions`>
`parsed` | `unknown`[]

#### # Returns

`number`

#### # Defined in

index.esm.d.ts:640
(opens new window)

### # buildOrUpdateElements

▸ buildOrUpdateElements(`resetNewElements?`): `void`

#### # Parameters

Name | Type
--- | ---
`resetNewElements?` | `boolean`

#### # Returns

`void`

#### # Defined in

index.esm.d.ts:605
(opens new window)

### # configure

▸ configure(): `void`

#### # Returns

`void`

#### # Defined in

index.esm.d.ts:602
(opens new window)

### # draw

▸ draw(): `void`

#### # Returns

`void`

#### # Defined in

index.esm.d.ts:597
(opens new window)

### # getAllParsedValues

▸ getAllParsedValues(`scale`): `number`[]

#### # Parameters

Name | Type
--- | ---
`scale` | `Scale`<`CoreScaleOptions`>

#### # Returns

`number`[]

#### # Defined in

index.esm.d.ts:591
(opens new window)

### # getDataset

▸ getDataset(): `ChartDataset`<keyof `ChartTypeRegistry`, (`number` | `ScatterDataPoint` | `BubbleDataPoint`)[]>

#### # Returns

`ChartDataset`<keyof `ChartTypeRegistry`, (`number` | `ScatterDataPoint` | `BubbleDataPoint`)[]>

#### # Defined in

index.esm.d.ts:599
(opens new window)

### # getLabelAndValue

▸ `Protected` getLabelAndValue(`index`): `Object`

#### # Parameters

Name | Type
--- | ---
`index` | `number`

#### # Returns

`Object`

Name | Type
--- | ---
`label` | `string`
`value` | `string`

#### # Defined in

index.esm.d.ts:592
(opens new window)

### # getMaxOverflow

▸ `Protected` getMaxOverflow(): `number` | `boolean`

#### # Returns

`number` | `boolean`

#### # Defined in

index.esm.d.ts:596
(opens new window)

### # getMeta

▸ getMeta(): `ChartMeta`<`TElement`, `TDatasetElement`, `TType`>

#### # Returns

`ChartMeta`<`TElement`, `TDatasetElement`, `TType`>

#### # Defined in

index.esm.d.ts:600
(opens new window)

### # getMinMax

▸ `Protected` getMinMax(`scale`, `canStack?`): `Object`

#### # Parameters

Name | Type
--- | ---
`scale` | `Scale`<`CoreScaleOptions`>
`canStack?` | `boolean`

#### # Returns

`Object`

Name | Type
--- | ---
`max` | `number`
`min` | `number`

#### # Defined in

index.esm.d.ts:647
(opens new window)

### # getParsed

▸ `Protected` getParsed(`index`): `TParsedData`

#### # Parameters

Name | Type
--- | ---
`index` | `number`

#### # Returns

`TParsedData`

#### # Defined in

index.esm.d.ts:639
(opens new window)

### # getScaleForId

▸ getScaleForId(`scaleID`): `Scale`<`CoreScaleOptions`>

#### # Parameters

Name | Type
--- | ---
`scaleID` | `string`

#### # Returns

`Scale`<`CoreScaleOptions`>

#### # Defined in

index.esm.d.ts:601
(opens new window)

### # getSharedOptions

▸ `Protected` getSharedOptions(`options`): `AnyObject`

Utility for checking if the options are shared and should be animated separately.

#### # Parameters

Name | Type
--- | ---
`options` | `AnyObject`

#### # Returns

`AnyObject`

#### # Defined in

index.esm.d.ts:614
(opens new window)

### # getStyle

▸ getStyle(`index`, `active`): `AnyObject`

#### # Parameters

Name | Type
--- | ---
`index` | `number`
`active` | `boolean`

#### # Returns

`AnyObject`

#### # Defined in

index.esm.d.ts:607
(opens new window)

### # includeOptions

▸ `Protected` includeOptions(`mode`, `sharedOptions`): `boolean`

Utility for determining if `options` should be included in the updated properties

#### # Parameters

Name | Type
--- | ---
`mode` | `"resize"` | `"reset"` | `"none"` | `"hide"` | `"show"` | `"normal"` | `"active"`
`sharedOptions` | `AnyObject`

#### # Returns

`boolean`

#### # Defined in

index.esm.d.ts:619
(opens new window)

### # initialize

▸ initialize(): `void`

#### # Returns

`void`

#### # Defined in

index.esm.d.ts:603
(opens new window)

### # linkScales

▸ linkScales(): `void`

#### # Returns

`void`

#### # Defined in

index.esm.d.ts:590
(opens new window)

### # parse

▸ parse(`start`, `count`): `void`

#### # Parameters

Name | Type
--- | ---
`start` | `number`
`count` | `number`

#### # Returns

`void`

#### # Defined in

index.esm.d.ts:635
(opens new window)

### # parseArrayData

▸ `Protected` parseArrayData(`meta`, `data`, `start`, `count`): `AnyObject`[]

#### # Parameters

Name | Type
--- | ---
`meta` | `ChartMeta`<`TElement`, `TDatasetElement`, `TType`>
`data` | `AnyObject`[]
`start` | `number`
`count` | `number`

#### # Returns

`AnyObject`[]

#### # Defined in

index.esm.d.ts:637
(opens new window)

### # parseObjectData

▸ `Protected` parseObjectData(`meta`, `data`, `start`, `count`): `AnyObject`[]

#### # Parameters

Name | Type
--- | ---
`meta` | `ChartMeta`<`TElement`, `TDatasetElement`, `TType`>
`data` | `AnyObject`[]
`start` | `number`
`count` | `number`

#### # Returns

`AnyObject`[]

#### # Defined in

index.esm.d.ts:638
(opens new window)

### # parsePrimitiveData

▸ `Protected` parsePrimitiveData(`meta`, `data`, `start`, `count`): `AnyObject`[]

#### # Parameters

Name | Type
--- | ---
`meta` | `ChartMeta`<`TElement`, `TDatasetElement`, `TType`>
`data` | `AnyObject`[]
`start` | `number`
`count` | `number`

#### # Returns

`AnyObject`[]

#### # Defined in

index.esm.d.ts:636
(opens new window)

### # removeHoverStyle

▸ removeHoverStyle(`element`, `datasetIndex`, `index`): `void`

#### # Parameters

Name | Type
--- | ---
`element` | `TElement`
`datasetIndex` | `number`
`index` | `number`

#### # Returns

`void`

#### # Defined in

index.esm.d.ts:632
(opens new window)

### # reset

▸ reset(): `void`

#### # Returns

`void`

#### # Defined in

index.esm.d.ts:598
(opens new window)

### # resolveDataElementOptions

▸ `Protected` resolveDataElementOptions(`index`, `mode`): `AnyObject`

#### # Parameters

Name | Type
--- | ---
`index` | `number`
`mode` | `"resize"` | `"reset"` | `"none"` | `"hide"` | `"show"` | `"normal"` | `"active"`

#### # Returns

`AnyObject`

#### # Defined in

index.esm.d.ts:609
(opens new window)

### # resolveDatasetElementOptions

▸ `Protected` resolveDatasetElementOptions(`mode`): `AnyObject`

#### # Parameters

Name | Type
--- | ---
`mode` | `"resize"` | `"reset"` | `"none"` | `"hide"` | `"show"` | `"normal"` | `"active"`

#### # Returns

`AnyObject`

#### # Defined in

index.esm.d.ts:608
(opens new window)

### # setHoverStyle

▸ setHoverStyle(`element`, `datasetIndex`, `index`): `void`

#### # Parameters

Name | Type
--- | ---
`element` | `TElement`
`datasetIndex` | `number`
`index` | `number`

#### # Returns

`void`

#### # Defined in

index.esm.d.ts:633
(opens new window)

### # update

▸ update(`mode`): `void`

#### # Parameters

Name | Type
--- | ---
`mode` | `"resize"` | `"reset"` | `"none"` | `"hide"` | `"show"` | `"normal"` | `"active"`

#### # Returns

`void`

#### # Defined in

index.esm.d.ts:594
(opens new window)

### # updateElement

▸ `Protected` updateElement(`element`, `index`, `properties`, `mode`): `void`

Utility for updating an element with new properties, using animations when appropriate.

#### # Parameters

Name | Type
--- | ---
`element` | `TElement` | `TDatasetElement`
`index` | `number`
`properties` | `AnyObject`
`mode` | `"resize"` | `"reset"` | `"none"` | `"hide"` | `"show"` | `"normal"` | `"active"`

#### # Returns

`void`

#### # Defined in

index.esm.d.ts:625
(opens new window)

### # updateElements

▸ updateElements(`elements`, `start`, `count`, `mode`): `void`

#### # Parameters

Name | Type
--- | ---
`elements` | `TElement`[]
`start` | `number`
`count` | `number`
`mode` | `"resize"` | `"reset"` | `"none"` | `"hide"` | `"show"` | `"normal"` | `"active"`

#### # Returns

`void`

#### # Defined in

index.esm.d.ts:593
(opens new window)

### # updateIndex

▸ updateIndex(`datasetIndex`): `void`

#### # Parameters

Name | Type
--- | ---
`datasetIndex` | `number`

#### # Returns

`void`

#### # Defined in

index.esm.d.ts:595
(opens new window)

### # updateRangeFromParsed

▸ `Protected` updateRangeFromParsed(`range`, `scale`, `parsed`, `stack`): `void`

#### # Parameters

Name | Type
--- | ---
`range` | `Object`
`range.max` | `number`
`range.min` | `number`
`scale` | `Scale`<`CoreScaleOptions`>
`parsed` | `unknown`[]
`stack` | `string` | `boolean`

#### # Returns

`void`

#### # Defined in

index.esm.d.ts:641
(opens new window)

### # updateSharedOptions

▸ `Protected` updateSharedOptions(`sharedOptions`, `mode`, `newOptions`): `void`

Utility to animate the shared options, that are potentially affecting multiple elements.

#### # Parameters

Name | Type
--- | ---
`sharedOptions` | `AnyObject`
`mode` | `"resize"` | `"reset"` | `"none"` | `"hide"` | `"show"` | `"normal"` | `"active"`
`newOptions` | `AnyObject`

#### # Returns

`void`

#### # Defined in

index.esm.d.ts:631
(opens new window)