Skip to content

Abstract Class: D3PCoordinateSystem<F> ​

Defined in: core/coords.ts:138

Turns positions along the axes (range units) into places on the chart and back: it knows the shape of the plot, how to place points and cells, where the cursor goes and what is inside. The cartesian and the polar systems are made from it.

Extends ​

Extended by ​

Type Parameters ​

F ​

F = any

the frame of the system: the immutable state its projections depend on (the size of the chart, its props...). Live projections read a fresh frame, snapshots keep one.

Implements ​

Constructors ​

Constructor ​

ts
new D3PCoordinateSystem<F>(
   kind, 
   name, 
   bus?
): D3PCoordinateSystem<F>;

Defined in: core/coords.ts:146

Parameters ​

kind ​

string

family of the system (cartesian, polar...): renderers and axis renderers declare which kinds they support.

name ​

string

bus? ​

D3PBus

Returns ​

D3PCoordinateSystem<F>

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


areaPath() ​

ts
abstract areaPath(
   chart, 
   pts, 
   b0, 
   curve?
): string | null;

Defined in: core/coords.ts:214

Area between the polyline and its base: the third component of each point, or the constant second-dimension value b0 when a point has none. Gaps break the area.

Parameters ​

chart ​

D3PChart

pts ​

D3PRangePoint[]

b0 ​

number

curve? ​

D3PCurve

Returns ​

string | null


attached() ​

ts
protected attached(chart): void;

Defined in: core/coords.ts:154

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

Parameters ​

chart ​

D3PChart

Returns ​

void

Overrides ​

D3PAttachable.attached


cellShape() ​

ts
abstract cellShape(
   chart, 
   a0, 
   a1, 
   b0, 
   b1
): D3PCellShape;

Defined in: core/coords.ts:216

The cell between a0..a1 and b0..b1 (range units): a rectangle, an arc...

Parameters ​

chart ​

D3PChart

a0 ​

number

a1 ​

number

b0 ​

number

b1 ​

number

Returns ​

D3PCellShape


changed() ​

ts
protected changed(): void;

Defined in: core/coords.ts:162

Announce that the geometry changed (axes rebuild their scales).

Returns ​

void


clipPath() ​

ts
clipPath(_chart): string | undefined;

Defined in: core/coords.ts:233

url(#id) of a clip path limiting what is drawn to the system's shape, if it has one.

Parameters ​

_chart ​

D3PChart

Returns ​

string | undefined


createData() ​

ts
protected createData(): object;

Defined in: core/coords.ts:151

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

Returns ​

object

Overrides ​

D3PAttachable.createData


cursor() ​

ts
abstract cursor(
   chart, 
   a, 
   b
): object;

Defined in: core/coords.ts:225

The shape of the cursor at a position of each dimension: a line, a circle or a path.

Parameters ​

chart ​

D3PChart

a ​

number | undefined

b ​

number | undefined

Returns ​

object

x? ​
ts
x?: D3PCursorGeometry;
y? ​
ts
y?: D3PCursorGeometry;

densify() ​

ts
densify(_chart, pts): D3PRangePoint[];

Defined in: core/coords.ts:205

Extra points so that a polyline in range units draws the right curve once projected.

Parameters ​

_chart ​

D3PChart

pts ​

D3PRangePoint[]

Returns ​

D3PRangePoint[]


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): void;

Defined in: core/coords.ts:157

DOM / registry cleanup (subscriptions are released afterwards).

Parameters ​

chart ​

D3PChart

Returns ​

void

Overrides ​

D3PAttachable.detached


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


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


inRange() ​

ts
inRange(
   _chart, 
   _a, 
   _b
): boolean;

Defined in: core/coords.ts:229

Whether a point in range units is inside the system (points outside are not drawn).

Parameters ​

_chart ​

D3PChart

_a ​

number

_b ​

number

Returns ​

boolean


label() ​

ts
abstract label(
   chart, 
   axis, 
   dim, 
   a, 
   b
): D3PLabelAnchor | undefined;

Defined in: core/coords.ts:227

Where the label of the cursor goes for an axis, given a position along each dimension.

Parameters ​

chart ​

D3PChart

axis ​

D3PAxis

dim ​

D3PDimension

a ​

number | undefined

b ​

number | undefined

Returns ​

D3PLabelAnchor | undefined


linePath() ​

ts
abstract linePath(
   chart, 
   pts, 
   curve?
): string | null;

Defined in: core/coords.ts:209

Points whose second value is not finite are gaps: the line breaks there.

Parameters ​

chart ​

D3PChart

pts ​

D3PRangePoint[]

curve? ​

D3PCurve

Returns ​

string | null


onDestroy() ​

ts
protected onDestroy(): void;

Defined in: core/object.ts:114

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

Returns ​

void

Inherited from ​

D3PAttachable.onDestroy


projectFrom() ​

ts
projectFrom(
   point, 
   options?, 
   cache?
): D3PRangePoint | undefined;

Defined in: core/coords.ts:192

Viewport point to range units. strict (default) returns undefined outside of the system; tools pass strict: false to keep following a drag that left it.

Parameters ​

point ​

D3PViewportPoint

options? ​
strict? ​

boolean

cache? ​

D3PProjectionCache

Returns ​

D3PRangePoint | undefined

Implementation of ​

D3PSystemProjector.projectFrom


projectTo() ​

ts
projectTo(
   chart, 
   a, 
   b, 
   cache?
): D3PViewportPoint;

Defined in: core/coords.ts:186

Range units to a viewport point.

Parameters ​

chart ​

D3PChart

a ​

number

b ​

number

cache? ​

D3PProjectionCache

Returns ​

D3PViewportPoint

Implementation of ​

D3PSystemProjector.projectTo


ranges() ​

ts
ranges(chart): D3PSystemRanges;

Defined in: core/coords.ts:183

Ranges of the scales of the first (x) and second (y) dimension.

Parameters ​

chart ​

D3PChart

Returns ​

D3PSystemRanges

Implementation of ​

D3PSystemProjector.ranges


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): 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>

Inherited from ​

D3PAttachable.render


selectionShape() ​

ts
abstract selectionShape(
   chart, 
   from, 
   to
): D3PSelectionShape;

Defined in: core/coords.ts:218

Shape of a selection dragged between two points of the inner area.

Parameters ​

chart ​

D3PChart

from ​

[number, number]

to ​

[number, number]

Returns ​

D3PSelectionShape


snapshot() ​

ts
snapshot(chart): D3PSystemSnapshot<F>;

Defined in: core/coords.ts:200

The system as it is now, to compare the state of a gesture's start with the live one.

Parameters ​

chart ​

D3PChart

Returns ​

D3PSystemSnapshot<F>


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

Inherited from ​

D3PAttachable.tagDirty


tooltipAnchor() ​

ts
abstract tooltipAnchor(
   chart, 
   a, 
   b, 
   ratioY, 
   pointer?
): [number, number];

Defined in: core/coords.ts:223

Where the tooltip box is anchored for a data point (a, b). pointer is the pointer position when it is over this chart; ratioY its relative height, which other charts reuse.

Parameters ​

chart ​

D3PChart

a ​

number

b ​

number

ratioY ​

number

pointer? ​

[number, number]

Returns ​

[number, number]


wrap() ​

ts
wrap(
   chart, 
   dim, 
   delta
): number;

Defined in: core/coords.ts:196

Normalize a difference along a dimension (an angle wraps around).

Parameters ​

chart ​

D3PChart

dim ​

D3PDimension

delta ​

number

Returns ​

number

Implementation of ​

D3PSystemProjector.wrap

Properties ​

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, {
}>;

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


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


kind ​

ts
readonly kind: string;

Defined in: core/coords.ts:146

family of the system (cartesian, polar...): renderers and axis renderers declare which kinds they support.


name ​

ts
readonly name: string;

Defined in: core/coords.ts:140

The name of the system. Axes and renderers refer to it with their system option.


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