Skip to main content
Version: Next

Interface: ISeriesPrimitiveBase<TSeriesAttachedParameters>

Base interface for series primitives. It must be implemented to add some external graphics to series

Type parameters

NameType
TSeriesAttachedParametersunknown

Methods

updateAllViews

Optional updateAllViews(): void

This method is called when viewport has been changed, so primitive have to recalculate / invalidate its data

Returns

void


priceAxisViews

Optional priceAxisViews(): readonly ISeriesPrimitiveAxisView[]

Returns array of labels to be drawn on the price axis used by the series

Returns

readonly ISeriesPrimitiveAxisView[]

array of objects; each of then must implement ISeriesPrimitiveAxisView interface

For performance reasons, the lightweight library uses internal caches based on references to arrays So, this method must return new array if set of views has changed and should try to return the same array if nothing changed


timeAxisViews

Optional timeAxisViews(): readonly ISeriesPrimitiveAxisView[]

Returns array of labels to be drawn on the time axis

Returns

readonly ISeriesPrimitiveAxisView[]

array of objects; each of then must implement ISeriesPrimitiveAxisView interface

For performance reasons, the lightweight library uses internal caches based on references to arrays So, this method must return new array if set of views has changed and should try to return the same array if nothing changed


paneViews

Optional paneViews(): readonly ISeriesPrimitivePaneView[]

Returns array of objects representing primitive in the main area of the chart

Returns

readonly ISeriesPrimitivePaneView[]

array of objects; each of then must implement ISeriesPrimitivePaneView interface

For performance reasons, the lightweight library uses internal caches based on references to arrays So, this method must return new array if set of views has changed and should try to return the same array if nothing changed


priceAxisPaneViews

Optional priceAxisPaneViews(): readonly ISeriesPrimitivePaneView[]

Returns array of objects representing primitive in the price axis area of the chart

Returns

readonly ISeriesPrimitivePaneView[]

array of objects; each of then must implement ISeriesPrimitivePaneView interface

For performance reasons, the lightweight library uses internal caches based on references to arrays So, this method must return new array if set of views has changed and should try to return the same array if nothing changed


timeAxisPaneViews

Optional timeAxisPaneViews(): readonly ISeriesPrimitivePaneView[]

Returns array of objects representing primitive in the time axis area of the chart

Returns

readonly ISeriesPrimitivePaneView[]

array of objects; each of then must implement ISeriesPrimitivePaneView interface

For performance reasons, the lightweight library uses internal caches based on references to arrays So, this method must return new array if set of views has changed and should try to return the same array if nothing changed


autoscaleInfo

Optional autoscaleInfo(startTimePoint, endTimePoint): AutoscaleInfo

Return autoscaleInfo which will be merged with the series base autoscaleInfo. You can use this to expand the autoscale range to include visual elements drawn outside of the series' current visible price range.

Important: Please note that this method will be evoked very often during scrolling and zooming of the chart, thus it is recommended that this method is either simple to execute, or makes use of optimisations such as caching to ensure that the chart remains responsive.

Parameters

NameTypeDescription
startTimePointLogicalstart time point for the current visible range
endTimePointLogicalend time point for the current visible range

Returns

AutoscaleInfo

AutoscaleInfo


attached

Optional attached(param): void

Attached Lifecycle hook.

Parameters

NameTypeDescription
paramTSeriesAttachedParametersAn object containing useful references for the attached primitive to use.

Returns

void

void


detached

Optional detached(): void

Detached Lifecycle hook.

Returns

void

void


hitTest

Optional hitTest(x, y): PrimitiveHoveredItem

Hit test method which will be called by the library when the cursor is moved. Use this to register object ids being hovered for use within the crosshairMoved and click events emitted by the chart. Additionally, the hit test result can specify a preferred cursor type to display for the main chart pane. This method should return the top most hit for this primitive if more than one object is being intersected.

Parameters

NameTypeDescription
xnumberx Coordinate of mouse event
ynumbery Coordinate of mouse event

Returns

PrimitiveHoveredItem