Skip to main content

Class: ChartView

Defined in: src/sdk/charts/ChartView.ts:29

A chart view.

Chart views represent a single updatable reference that can be updated to show a particular chart image.

The sim's engine manages downloading chart images and uploading them as GPU bitmaps. You must use the showChartImage method to choose which chart image should be shown for this view, after which liveViewName will be updated to give you access to that image. See documentation of that field for more information.

Implements

Constructors

Constructor

new ChartView(): ChartView

Returns

ChartView

Properties

_id

_id: null | string = null

Defined in: src/sdk/charts/ChartView.ts:37


image

readonly image: Subscribable<ChartImage>

Defined in: src/sdk/charts/ChartView.ts:48

The current supplied chart image.

Implementation of

ChartImageSupplier.image


liveView

readonly liveView: Subscribable<ChartViewLiveView>

Defined in: src/sdk/charts/ChartView.ts:54

A description of the LiveView currently backing this chart view.

Deprecated

Please use image instead.


liveViewName

readonly liveViewName: Subscribable<string>

Defined in: src/sdk/charts/ChartView.ts:60

The name of the LiveView currently backing this chart view.

Deprecated

Please use image instead.

Accessors

id

Get Signature

get id(): null | string

Defined in: src/sdk/charts/ChartView.ts:40

This view's GUID, or null if it has not been initialized yet.

Returns

null | string


isAlive

Get Signature

get isAlive(): boolean

Defined in: src/sdk/charts/ChartView.ts:33

Whether this view is alive.

Returns

boolean

Methods

destroy()

destroy(): void

Defined in: src/sdk/charts/ChartView.ts:125

Destroys this chart view. This will release resources associated with this view. Once the view is destroyed, it can no longer be used to display chart images.

Returns

void

Implementation of

ChartImageSupplier.destroy


init()

init(listener): Promise<void>

Defined in: src/sdk/charts/ChartView.ts:69

Initializes this chart view with a listener. This must be a JS_LISTENER_CHARTS ViewListener.

Parameters

ParameterTypeDescription
listenerViewListenerthe listener

Returns

Promise<void>

Throws

Error if this view has been destroyed.


showChartImage()

showChartImage(pageUrl): void

Defined in: src/sdk/charts/ChartView.ts:107

Updates this chart view to show a new chart image. Once the image has been retrieved, this view's backing LiveView will be updated to display the new image. If this view has not been initialized, then it will wait until it is initialized before it attempts to show the image.

Note: When changing the chart image, this view's backing LiveView will change. In order to ensure you have the most up-to-date LiveView information with which to display the chart image, subscribe to image or liveViewName.

Parameters

ParameterTypeDescription
pageUrlstringThe URL of the image to show. The URL should be sourced from a valid ChartPage record and point to a file in PNG format.

Returns

void

Throws

Error if this view has been destroyed.

Implementation of

ChartImageSupplier.showChartImage