Skip to content

Abstract Class: D3PAttachable<D, M> ​

Defined in: core/object.ts:64

Object attachable to N charts, keeping one D record per chart. It detaches itself when a chart is destroyed and on its own destroy().

Extends ​

Extended by ​

Type Parameters ​

D ​

D

M ​

M extends object = { }

Implements ​

Constructors ​

Constructor ​

ts
new D3PAttachable<D, M>(
   label, 
   eventNames?, 
   bus?
): D3PAttachable<D, M>;

Defined in: core/object.ts:35

Parameters ​

label ​

string

eventNames? ​

readonly (keyof M & string)[] = []

bus? ​

D3PBus

Returns ​

D3PAttachable<D, M>

Inherited from ​

D3PObject.constructor

Methods ​

addToChart() ​

ts
addToChart(chart): void;

Defined in: core/object.ts:77

Attaches the object to a chart; nothing happens if it already is attached to it.

Parameters ​

chart ​

D3PChart

Returns ​

void


attached() ​

ts
abstract protected attached(
   chart, 
   data, 
   subs
): void;

Defined in: core/object.ts:72

Subscribe / create DOM. Subscriptions added to subs are released on detach.

Parameters ​

chart ​

D3PChart

data ​

D

subs ​

D3PSubscriptions

Returns ​

void


createData() ​

ts
abstract protected createData(chart): D;

Defined in: core/object.ts:70

Build the per-chart record. Must not rely on other objects of the chart.

Parameters ​

chart ​

D3PChart

Returns ​

D


destroy() ​

ts
destroy(): void;

Defined in: core/object.ts:51

Detaches the object from all its charts, announces destroyed and releases its subscriptions. The object cannot be used afterwards.

Returns ​

void

Inherited from ​

D3PObject.destroy


detached() ​

ts
protected detached(_chart, _data): void;

Defined in: core/object.ts:74

DOM / registry cleanup (subscriptions are released afterwards).

Parameters ​

_chart ​

D3PChart

_data ​

D

Returns ​

void


fire() ​

ts
protected fire<P>(event, ...args): void;

Defined in: core/object.ts:41

Emits one of its own events on the bus.

Type Parameters ​

P ​

P

Parameters ​

event ​

D3PEvent<P>

args ​

...P extends void ? [] : [payload: P]

Returns ​

void

Inherited from ​

D3PObject.fire


getCharts() ​

ts
getCharts(): D3PChart[];

Defined in: core/object.ts:105

The charts the object is attached to.

Returns ​

D3PChart[]


hasChart() ​

ts
hasChart(chart): boolean;

Defined in: core/object.ts:110

Whether the object is attached to this chart.

Parameters ​

chart ​

D3PChart

Returns ​

boolean


onDestroy() ​

ts
protected onDestroy(): void;

Defined in: core/object.ts:114

Hook run first on destroy (detach from partners, release DOM...).

Returns ​

void

Overrides ​

D3PObject.onDestroy


removeFromChart() ​

ts
removeFromChart(chart): void;

Defined in: core/object.ts:95

Detaches the object from a chart; nothing happens if it is not attached to it.

Parameters ​

chart ​

D3PChart

Returns ​

void


render() ​

ts
render(_chart): void | Promise<void>;

Defined in: core/object.ts:129

Draws the object on a chart. The render manager calls it, once per frame, for the objects that asked for it.

Parameters ​

_chart ​

D3PChart

Returns ​

void | Promise<void>

Implementation of ​

D3PRenderable.render


tagDirty() ​

ts
tagDirty(chart?): void;

Defined in: core/object.ts:119

Schedule a redraw on one chart (or all attached charts).

Parameters ​

chart? ​

D3PChart

Returns ​

void

Properties ​

bus ​

ts
readonly bus: D3PBus;

Defined in: core/object.ts:27

The bus the object uses for its events.

Inherited from ​

D3PObject.bus


chartData ​

ts
protected readonly chartData: Map<D3PChart, D>;

Defined in: core/object.ts:66

What the object keeps for each chart it is attached to.


e ​

ts
readonly e: D3PEventTable<M & object>;

Defined in: core/object.ts:29

The events of the object, by name: destroyed for all, and its own (axis.e.scaleChanged).

Inherited from ​

D3PObject.e


isDestroying ​

ts
isDestroying: boolean = false;

Defined in: core/object.ts:31

Set when destroy starts: the object is not drawn after that.

Implementation of ​

D3PRenderable.isDestroying

Inherited from ​

D3PObject.isDestroying


subs ​

ts
protected readonly subs: D3PSubscriptions;

Defined in: core/object.ts:33

The subscriptions of the object, released when it is destroyed.

Inherited from ​

D3PObject.subs