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

# # Class: BasicPlatform

## # Hierarchy

- `BasePlatform`

  ↳ `BasicPlatform`

## # Constructors

### # constructor

• new BasicPlatform()

#### # Inherited from

BasePlatform.constructor

## # Methods

### # acquireContext

▸ acquireContext(`canvas`, `options?`): `CanvasRenderingContext2D`

Called at chart construction time, returns a context2d instance implementing the W3C Canvas 2D Context API standard
(opens new window).

#### # Parameters

Name | Type | Description
--- | --- | ---
`canvas` | `HTMLCanvasElement` | The canvas from which to acquire context (platform specific)
`options?` | `CanvasRenderingContext2DSettings` | The chart options

#### # Returns

`CanvasRenderingContext2D`

#### # Inherited from

BasePlatform.acquireContext

#### # Defined in

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

### # addEventListener

▸ addEventListener(`chart`, `type`, `listener`): `void`

Registers the specified listener on the given chart.

#### # Parameters

Name | Type | Description
--- | --- | ---
`chart` | `Chart`<keyof `ChartTypeRegistry`, (`number` | `ScatterDataPoint` | `BubbleDataPoint`)[], `unknown`> | Chart from which to listen for event
`type` | `string` | The (ChartEvent) type to listen for
`listener` | (`e`: `ChartEvent`) => `void` | Receives a notification (an object that implements the ChartEvent interface) when an event of the specified type occurs.

#### # Returns

`void`

#### # Inherited from

BasePlatform.addEventListener

#### # Defined in

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

### # getDevicePixelRatio

▸ getDevicePixelRatio(): `number`

#### # Returns

`number`

the current devicePixelRatio of the device this platform is connected to.

#### # Inherited from

BasePlatform.getDevicePixelRatio

#### # Defined in

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

### # getMaximumSize

▸ getMaximumSize(`canvas`, `width?`, `height?`, `aspectRatio?`): `Object`

#### # Parameters

Name | Type | Description
--- | --- | ---
`canvas` | `HTMLCanvasElement` | The canvas for which to calculate the maximum size
`width?` | `number` | -
`height?` | `number` | -
`aspectRatio?` | `number` | -

#### # Returns

`Object`

the maximum size available.

Name | Type
--- | ---
`height` | `number`
`width` | `number`

#### # Inherited from

BasePlatform.getMaximumSize

#### # Defined in

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

### # isAttached

▸ isAttached(`canvas`): `boolean`

#### # Parameters

Name | Type
--- | ---
`canvas` | `HTMLCanvasElement`

#### # Returns

`boolean`

true if the canvas is attached to the platform, false if not.

#### # Inherited from

BasePlatform.isAttached

#### # Defined in

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

### # releaseContext

▸ releaseContext(`context`): `boolean`

Called at chart destruction time, releases any resources associated to the context previously returned by the acquireContext() method.

#### # Parameters

Name | Type | Description
--- | --- | ---
`context` | `CanvasRenderingContext2D` | The context2d instance

#### # Returns

`boolean`

true if the method succeeded, else false

#### # Inherited from

BasePlatform.releaseContext

#### # Defined in

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

### # removeEventListener

▸ removeEventListener(`chart`, `type`, `listener`): `void`

Removes the specified listener previously registered with addEventListener.

#### # Parameters

Name | Type | Description
--- | --- | ---
`chart` | `Chart`<keyof `ChartTypeRegistry`, (`number` | `ScatterDataPoint` | `BubbleDataPoint`)[], `unknown`> | Chart from which to remove the listener
`type` | `string` | The (ChartEvent) type to remove
`listener` | (`e`: `ChartEvent`) => `void` | The listener function to remove from the event target.

#### # Returns

`void`

#### # Inherited from

BasePlatform.removeEventListener

#### # Defined in

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

### # updateConfig

▸ updateConfig(`config`): `void`

Updates config with platform specific requirements

#### # Parameters

Name | Type
--- | ---
`config` | `ChartConfiguration`<keyof `ChartTypeRegistry`, (`number` | `ScatterDataPoint` | `BubbleDataPoint`)[], `unknown`> | `ChartConfigurationCustomTypesPerDataset`<keyof `ChartTypeRegistry`, (`number` | `ScatterDataPoint` | `BubbleDataPoint`)[], `unknown`>

#### # Returns

`void`

#### # Inherited from

BasePlatform.updateConfig

#### # Defined in

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