Skip to content

Class: D3PPointerEvent ​

Defined in: core/pointer.ts:16

A mouse event on a chart, as the interaction area emits it. It carries the pixel under the pointer and is the projection cache of that event: everything that asks axis.projectFrom(event.point, undefined, event) (the tooltip, the cursor, the markers, a tool) shares one computation, and nothing is computed if nobody asks. Projections read the live state of the chart.

An event is valid for the moment it was emitted, up to the next redraw. To compare the live state with the one of a gesture's start, take a D3PViewSnapshot with snapshot() instead of keeping the event.

Extends ​

Extended by ​

Accessors ​

x ​

Get Signature ​

ts
get x(): number;

Defined in: core/pointer.ts:35

X of the pointer, in pixels, in the plot.

Returns ​

number


y ​

Get Signature ​

ts
get y(): number;

Defined in: core/pointer.ts:39

Y of the pointer, in pixels, in the plot.

Returns ​

number

Constructors ​

Constructor ​

ts
new D3PPointerEvent(
   chart, 
   x, 
   y, 
   original
): D3PPointerEvent;

Defined in: core/pointer.ts:20

Parameters ​

chart ​

D3PChart

The chart the pointer is on.

x ​

number

X of the pointer, in pixels, in the plot.

y ​

number

Y of the pointer, in pixels, in the plot.

original ​

MouseEvent

The DOM event.

Returns ​

D3PPointerEvent

Overrides ​

D3PProjectionMemo.constructor

Methods ​

memo() ​

ts
memo<T>(
   projector, 
   chart, 
   key, 
   compute
): T;

Defined in: core/projection.ts:55

The value of compute for these arguments: computed once, then kept as long as the event is.

Type Parameters ​

T ​

T

Parameters ​

projector ​

object

chart ​

D3PChart

key ​

unknown

compute ​

() => T

Returns ​

T

Inherited from ​

D3PProjectionMemo.memo


snapshot() ​

ts
snapshot(): D3PViewSnapshot;

Defined in: core/pointer.ts:44

Freeze the axes and systems of the chart as they are now.

Returns ​

D3PViewSnapshot

Properties ​

chart ​

ts
readonly chart: D3PChart;

Defined in: core/pointer.ts:22

The chart the pointer is on.


original ​

ts
readonly original: MouseEvent;

Defined in: core/pointer.ts:28

The DOM event.


point ​

ts
readonly point: D3PViewportPoint;

Defined in: core/pointer.ts:18

The pixel under the pointer, in the inner area of the chart.