Skip to content

Abstract Class: D3PSeriesRenderer<P, G> ​

Defined in: core/renderers/base.ts:98

Base of every series renderer. Subtypes provide the props defaults and the drawing hooks. A redraw asked by a change of the data, of the props or of the series is animated, even when the scale changes in the same frame (an auto domain fitting new data). A scale change alone is drawn at once, so panning/zooming never lags behind the pointer.

Extends ​

Extended by ​

Type Parameters ​

P ​

P extends object = any

G ​

G = any

Accessors ​

color ​

Get Signature ​

ts
get color(): string;

Defined in: core/renderers/base.ts:194

The color of the renderer: the one in its style, or the one its name gives.

Returns ​

string


marker ​

Get Signature ​

ts
get marker(): D3PMarker | undefined;

Defined in: core/renderers/base.ts:140

What shows the point under the pointer; undefined for none.

Returns ​

D3PMarker | undefined

Set Signature ​

ts
set marker(m): void;

Defined in: core/renderers/base.ts:144

Replaces the marker, or removes it with undefined.

Parameters ​
m ​

D3PMarker | undefined

Returns ​

void


props ​

Get Signature ​

ts
get props(): D3PProps<P & object>;

Defined in: core/renderers/base.ts:159

The props of the renderer: its style, what its type adds, and visible.

Returns ​

D3PProps<P & object>

Set Signature ​

ts
set props(v): void;

Defined in: core/renderers/base.ts:163

Merges props into those of the renderer; it is drawn again, with a transition.

Parameters ​
v ​

DeepPartial<P & object>

Returns ​

void


series ​

Get Signature ​

ts
get series(): D3PSeries;

Defined in: core/renderers/base.ts:168

The series the renderer draws.

Returns ​

D3PSeries

Set Signature ​

ts
set series(s): void;

Defined in: core/renderers/base.ts:172

Changes the series: the renderer is drawn again.

Parameters ​
s ​

D3PSeries

Returns ​

void


visible ​

Get Signature ​

ts
get visible(): boolean;

Defined in: core/renderers/base.ts:183

Whether the renderer is shown.

Returns ​

boolean

Set Signature ​

ts
set visible(v): void;

Defined in: core/renderers/base.ts:187

Shows or hides the renderer, with a transition.

Parameters ​
v ​

boolean

Returns ​

void

Constructors ​

Constructor ​

ts
new D3PSeriesRenderer<P, G>(opts, defaults): D3PSeriesRenderer<P, G>;

Defined in: core/renderers/base.ts:122

Parameters ​

opts ​

D3PSeriesRendererOptions<P>

defaults ​

P

Returns ​

D3PSeriesRenderer<P, G>

Overrides ​

D3PAttachable.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

Inherited from ​

D3PAttachable.addToChart


attached() ​

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

Defined in: core/renderers/base.ts:295

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

Parameters ​

chart ​

D3PChart

data ​

D3PRendererChartData<G>

subs ​

D3PSubscriptions

Returns ​

void

Overrides ​

D3PAttachable.attached


chartAdded() ​

ts
abstract protected chartAdded(chart, data): void;

Defined in: core/renderers/base.ts:409

Called when the renderer is attached to a chart, to create what it draws with.

Parameters ​

chart ​

D3PChart

data ​

G

Returns ​

void


chartRemoved() ​

ts
abstract protected chartRemoved(chart, data): void;

Defined in: core/renderers/base.ts:411

Called when the renderer leaves a chart, to remove what it created.

Parameters ​

chart ​

D3PChart

data ​

G

Returns ​

void


checkColumns() ​

ts
protected checkColumns(series?): void;

Defined in: core/renderers/base.ts:255

Throws when the series lacks a column this renderer reads.

Parameters ​

series? ​

D3PSeries = ...

Returns ​

void


createData() ​

ts
protected createData(chart): D3PRendererChartData<G>;

Defined in: core/renderers/base.ts:291

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

Parameters ​

chart ​

D3PChart

Returns ​

D3PRendererChartData<G>

Overrides ​

D3PAttachable.createData


createGroup() ​

ts
protected createGroup(chart): Group;

Defined in: core/renderers/base.ts:420

Create the renderer's own group in the middle data layer.

Parameters ​

chart ​

D3PChart

Returns ​

Group


createMarker() ​

ts
createMarker(): D3PMarker | undefined;

Defined in: core/renderers/base.ts:152

The marker this kind of renderer has by default (none unless overridden).

Returns ​

D3PMarker | undefined


createRendererData() ​

ts
abstract protected createRendererData(chart): G;

Defined in: core/renderers/base.ts:407

Creates what the renderer keeps for a chart.

Parameters ​

chart ​

D3PChart

Returns ​

G


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 ​

D3PAttachable.destroy


detached() ​

ts
protected detached(chart, data): void;

Defined in: core/renderers/base.ts:306

DOM / registry cleanup (subscriptions are released afterwards).

Parameters ​

chart ​

D3PChart

data ​

D3PRendererChartData<G>

Returns ​

void

Overrides ​

D3PAttachable.detached


entriesChanged() ​

ts
protected entriesChanged(): void;

Defined in: core/renderers/base.ts:210

Announce that legendEntries() changed (the legend refreshes).

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 ​

D3PAttachable.fire


getAxes() ​

ts
getAxes(chart): object;

Defined in: core/renderers/base.ts:320

Axes this renderer draws against on chart: the one the series' x is plotted on, and the one for its y. By default the first X-component axis and the first Y-component axis of the same coordinate system; a horizontal renderer swaps them.

Parameters ​

chart ​

D3PChart

Returns ​

object

x? ​
ts
x?: D3PAxis;
y? ​
ts
y?: D3PAxis;

getCharts() ​

ts
getCharts(): D3PChart[];

Defined in: core/object.ts:105

The charts the object is attached to.

Returns ​

D3PChart[]

Inherited from ​

D3PAttachable.getCharts


hasChart() ​

ts
hasChart(chart): boolean;

Defined in: core/object.ts:110

Whether the object is attached to this chart.

Parameters ​

chart ​

D3PChart

Returns ​

boolean

Inherited from ​

D3PAttachable.hasChart


legendEntries() ​

ts
legendEntries(): D3PLegendItem[];

Defined in: core/renderers/base.ts:215

The legend lines of this renderer: itself by default.

Returns ​

D3PLegendItem[]


onDestroy() ​

ts
protected onDestroy(): void;

Defined in: core/renderers/base.ts:264

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

Returns ​

void

Overrides ​

D3PAttachable.onDestroy


probeHit() ​

ts
probeHit(
   chart, 
   event, 
   joins?
): D3PProbeHit | undefined;

Defined in: core/renderers/base.ts:225

What this renderer finds for event on chart: by default the data point whose X is closest to the value under the pointer (read through the probe, so joins apply). Renderers that do not map data through axes (a pie) test the pixel instead. Ask the probe (d3pProbe(chart).hit) rather than this method: it computes once per event.

Parameters ​

chart ​

D3PChart

event ​

D3PPointerEvent

joins? ​

readonly D3PJoinGroup[] = []

Returns ​

D3PProbeHit | undefined


projectFrom() ​

ts
projectFrom(point, cache?): 
  | [D3PDomainValue, D3PDomainValue]
  | undefined;

Defined in: core/renderers/base.ts:358

Data values [x, y] under a viewport point; undefined outside of the system.

Parameters ​

point ​

D3PViewportPoint

cache? ​

D3PProjectionCache

Returns ​

| [D3PDomainValue, D3PDomainValue] | undefined


projectTo() ​

ts
projectTo(
   chart, 
   x, 
   y, 
   cache?
): D3PViewportPoint | undefined;

Defined in: core/renderers/base.ts:351

Viewport point of the data point (x, y).

Parameters ​

chart ​

D3PChart

x ​

D3PDomainValue

y ​

D3PDomainValue

cache? ​

D3PProjectionCache

Returns ​

D3PViewportPoint | undefined


projectToRange() ​

ts
projectToRange(
   chart, 
   x, 
   y, 
   cache?
): [number, number] | undefined;

Defined in: core/renderers/base.ts:341

Position of the data point (x, y) in range units, in the order of the dimensions of the system (the series' x goes on the first dimension unless the renderer is horizontal).

Parameters ​

chart ​

D3PChart

x ​

D3PDomainValue

y ​

D3PDomainValue

cache? ​

D3PProjectionCache

Returns ​

[number, number] | undefined


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

Inherited from ​

D3PAttachable.removeFromChart


render() ​

ts
render(chart): Promise<void>;

Defined in: core/renderers/base.ts:387

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 ​

Promise<void>

Overrides ​

D3PAttachable.render


renderData() ​

ts
abstract protected renderData(
   chart, 
   data, 
   x?, 
   y?
): void;

Defined in: core/renderers/base.ts:413

Draws the series at once, with no transition.

Parameters ​

chart ​

D3PChart

data ​

G

x? ​

D3PAxis

y? ​

D3PAxis

Returns ​

void


renderDataHidden() ​

ts
abstract protected renderDataHidden(
   chart, 
   data, 
   x?, 
   y?
): void;

Defined in: core/renderers/base.ts:417

Draws the series going away: the renderer was hidden.

Parameters ​

chart ​

D3PChart

data ​

G

x? ​

D3PAxis

y? ​

D3PAxis

Returns ​

void


renderDataWithTransition() ​

ts
abstract protected renderDataWithTransition(
   chart, 
   data, 
   x?, 
   y?
): void;

Defined in: core/renderers/base.ts:415

Draws the series moving from what is on screen to what the data and the scales say now.

Parameters ​

chart ​

D3PChart

data ​

G

x? ​

D3PAxis

y? ​

D3PAxis

Returns ​

void


scalesOf() ​

ts
protected scalesOf(
   chart, 
   x?, 
   y?
): 
  | {
  sx: D3PScale;
  sy: D3PScale;
  system: D3PCoordinateSystem;
}
  | undefined;

Defined in: core/renderers/base.ts:430

Scales and coordinate system to draw with; throws if the system is not one the renderer supports.

Parameters ​

chart ​

D3PChart

x? ​

D3PAxis

y? ​

D3PAxis

Returns ​

| { sx: D3PScale; sy: D3PScale; system: D3PCoordinateSystem; } | undefined


seriesChanged() ​

ts
protected seriesChanged(): void;

Defined in: core/renderers/base.ts:207

The series, or its data, changed. Renderers whose legend depends on the data announce it here.

Returns ​

void


tagDirty() ​

ts
tagDirty(chart?): void;

Defined in: core/renderers/base.ts:276

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

Parameters ​

chart? ​

D3PChart

Returns ​

void

Overrides ​

D3PAttachable.tagDirty


tagDirtyWithTransition() ​

ts
tagDirtyWithTransition(chart?): void;

Defined in: core/renderers/base.ts:272

Asks to draw again, with a transition: on one chart, or on all of them.

Parameters ​

chart? ​

D3PChart

Returns ​

void

Properties ​

axes ​

ts
readonly axes: D3PAxisFilter | undefined;

Defined in: core/renderers/base.ts:109

The axes the renderer is restricted to (objects or names), if any.


bus ​

ts
readonly bus: D3PBus;

Defined in: core/object.ts:27

The bus the object uses for its events.

Inherited from ​

D3PAttachable.bus


chartData ​

ts
protected readonly chartData: Map<D3PChart, D3PRendererChartData<G>>;

Defined in: core/object.ts:66

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

Inherited from ​

D3PAttachable.chartData


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 ​

D3PAttachable.e


id ​

ts
readonly id: number = ++D3PSeriesRenderer.counter;

Defined in: core/renderers/base.ts:105

A number that identifies the renderer: 1 for the first one created.


isDestroying ​

ts
isDestroying: boolean = false;

Defined in: core/object.ts:31

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

Inherited from ​

D3PAttachable.isDestroying


name ​

ts
readonly name: string;

Defined in: core/renderers/base.ts:107

The name of the renderer: the series name unless given.


propsHandle ​

ts
protected readonly propsHandle: D3PPropsHandle<P & object>;

Defined in: core/renderers/base.ts:117

The props and their change hooks.


requiredColumns ​

ts
protected readonly requiredColumns: readonly string[] = [];

Defined in: core/renderers/base.ts:115

Columns the series must have (['open', 'high', 'low', 'close']); checked when attaching.


subs ​

ts
protected readonly subs: D3PSubscriptions;

Defined in: core/object.ts:33

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

Inherited from ​

D3PAttachable.subs


system ​

ts
readonly system: string | undefined;

Defined in: core/renderers/base.ts:111

The name of the coordinate system the renderer draws in, if it was given one.


systemKinds ​

ts
protected readonly systemKinds: readonly string[] | undefined = undefined;

Defined in: core/renderers/base.ts:113

Kinds of coordinate system the renderer can draw in (undefined: any).