Skip to content
EliteChart

OverlayPlugin\<Params\>

Documentation


Documentation / @elitechart/core / OverlayPlugin

Defined in: plugin/types.ts:145

An overlay plugin — a read-only visual layer. Unlike indicators, overlays have their own render function and don't produce a numeric series.

Example

code
const lastClose: OverlayPlugin<{ width: number }> = {
  id: 'last-close-line', name: 'Last close line',
  kind: 'overlay', targets: { interfaceVersion: '1' },
  defaultParams: { width: 2 },
  render: (paint, vp, bars, { width }) => {
    const last = bars[bars.length - 1];
    if (last !== undefined) {
      const y = vp.priceToY(last.close);
      paint.fillRect(vp.plotLeft, y - width/2, vp.plotWidth, width, '#4f8cff');
    }
  },
};

Extends

Type Parameters

Params

Params = Record<string, unknown>

Properties

defaultParams

code
readonly defaultParams: Params;

Defined in: plugin/types.ts:147


id

code
readonly id: string;

Defined in: plugin/types.ts:54

Stable, globally unique id. Reverse-DNS or scope-prefixed recommended.

Inherited from

PluginMeta.id


kind

code
readonly kind: "overlay";

Defined in: plugin/types.ts:146

Declared plugin category.

Overrides

PluginMeta.kind


name

code
readonly name: string;

Defined in: plugin/types.ts:56

Human-readable display name.

Inherited from

PluginMeta.name


targets

code
readonly targets: {
  interfaceVersion: "1";
};

Defined in: plugin/types.ts:60

Plugin interface version the plugin targets.

interfaceVersion

code
readonly interfaceVersion: "1";

Inherited from

PluginMeta.targets

Methods

render()

code
render(
   paint, 
   viewport, 
   bars, 
   params): void;

Defined in: plugin/types.ts:148

Parameters

paint

Paint

viewport

Viewport

bars

readonly Bar[]

params

Params

Returns

void