# Class: BasePlatform

# Hierarchy

# Constructors

# constructor

+ new BasePlatform(): BasePlatform

Returns: BasePlatform

# Methods

# acquireContext

acquireContext(canvas: HTMLCanvasElement, options?: CanvasRenderingContext2DSettings): 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

Defined in: index.esm.d.ts:1908 (opens new window)


# addEventListener

addEventListener(chart: Chart<"bar" | "line" | "scatter" | "bubble" | "pie" | "doughnut" | "polarArea" | "radar", (number | ScatterDataPoint | BubbleDataPoint)[], unknown>, type: string, listener: (e: ChartEvent) => void): void

Registers the specified listener on the given chart.

# Parameters

Name Type Description
chart Chart<"bar" | "line" | "scatter" | "bubble" | "pie" | "doughnut" | "polarArea" | "radar", (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

Defined in: index.esm.d.ts:1926 (opens new window)


# getDevicePixelRatio

getDevicePixelRatio(): number

Returns: number

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

Defined in: index.esm.d.ts:1937 (opens new window)


# getMaximumSize

getMaximumSize(canvas: HTMLCanvasElement, width?: number, height?: number, aspectRatio?: number): object

# Parameters

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

Returns: object

Name Type
height number
width number

the maximum size available.

Defined in: index.esm.d.ts:1945 (opens new window)


# isAttached

isAttached(canvas: HTMLCanvasElement): boolean

# Parameters

Name Type
canvas HTMLCanvasElement

Returns: boolean

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

Defined in: index.esm.d.ts:1950 (opens new window)


# releaseContext

releaseContext(context: CanvasRenderingContext2D): 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

Defined in: index.esm.d.ts:1918 (opens new window)


# removeEventListener

removeEventListener(chart: Chart<"bar" | "line" | "scatter" | "bubble" | "pie" | "doughnut" | "polarArea" | "radar", (number | ScatterDataPoint | BubbleDataPoint)[], unknown>, type: string, listener: (e: ChartEvent) => void): void

Removes the specified listener previously registered with addEventListener.

# Parameters

Name Type Description
chart Chart<"bar" | "line" | "scatter" | "bubble" | "pie" | "doughnut" | "polarArea" | "radar", (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

Defined in: index.esm.d.ts:1933 (opens new window)