Class: DomPlatform

Hierarchy

Constructors

constructor

+ new DomPlatform(): DomPlatform

Returns: DomPlatform

Inherited from: 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 standardDomPlatform - 图1 (opens new window).

Parameters:

NameTypeDescription
canvasHTMLCanvasElementThe canvas from which to acquire context (platform specific)
options?CanvasRenderingContext2DSettingsThe chart options

Returns: CanvasRenderingContext2D

Inherited from: BasePlatform

Defined in: index.esm.d.ts:1878DomPlatform - 图2 (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:

NameTypeDescription
chartChart<bar | line | scatter | bubble | pie | doughnut | polarArea | radar, (number | ScatterDataPoint | BubbleDataPoint)[], unknown>Chart from which to listen for event
typestringThe (ChartEvent) type to listen for
listener(e: ChartEvent) => voidReceives a notification (an object that implements the ChartEvent interface) when an event of the specified type occurs.

Returns: void

Inherited from: BasePlatform

Defined in: index.esm.d.ts:1896DomPlatform - 图3 (opens new window)


getDevicePixelRatio

getDevicePixelRatio(): number

Returns: number

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

Inherited from: BasePlatform

Defined in: index.esm.d.ts:1907DomPlatform - 图4 (opens new window)


getMaximumSize

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

Parameters:

NameTypeDescription
canvasHTMLCanvasElementThe canvas for which to calculate the maximum size
width?number-
height?number-
aspectRatio?number-

Returns: object

NameType
heightnumber
widthnumber

the maximum size available.

Inherited from: BasePlatform

Defined in: index.esm.d.ts:1915DomPlatform - 图5 (opens new window)


isAttached

isAttached(canvas: HTMLCanvasElement): boolean

Parameters:

NameType
canvasHTMLCanvasElement

Returns: boolean

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

Inherited from: BasePlatform

Defined in: index.esm.d.ts:1920DomPlatform - 图6 (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:

NameTypeDescription
contextCanvasRenderingContext2DThe context2d instance

Returns: boolean

true if the method succeeded, else false

Inherited from: BasePlatform

Defined in: index.esm.d.ts:1888DomPlatform - 图7 (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:

NameTypeDescription
chartChart<bar | line | scatter | bubble | pie | doughnut | polarArea | radar, (number | ScatterDataPoint | BubbleDataPoint)[], unknown>Chart from which to remove the listener
typestringThe (ChartEvent) type to remove
listener(e: ChartEvent) => voidThe listener function to remove from the event target.

Returns: void

Inherited from: BasePlatform

Defined in: index.esm.d.ts:1903DomPlatform - 图8 (opens new window)