English
Class: D3PCursorIndicator
Defined in: core/cursor.ts:63
Crosshair + axis labels following the mouse on every chart it is attached to. The mouse state is shared: moving over chart A shows the cursor on each chart having axes of the same names. Each coordinate system draws its own crosshair (lines, or a spoke and a circle in polar), at the pointer or, through joined axes, at the corresponding value.
Extends
D3PAttachable<CursorData>
Accessors
props
Get Signature
ts
get props(): D3PProps<D3PCursorProps>;Defined in: core/cursor.ts:87
The props of the cursor: which crosses and labels it shows, their styles.
Returns
Set Signature
ts
set props(v): void;Defined in: core/cursor.ts:91
Merges props into those of the cursor.
Parameters
v
axisLabelStyle?
{ background?: string; borderRadius?: number; color?: string; fontSize?: number; maxWidth?: number; padding?: number; }
The labels on the axes. A label is never wider than maxWidth pixels, nor than the room the margin leaves it next to its axis, nor (above or under an axis) higher than that room: a longer text wraps onto several lines, and ends with an ellipsis where even that does not fit.
axisLabelStyle.background?
string
axisLabelStyle.borderRadius?
number
axisLabelStyle.color?
string
axisLabelStyle.fontSize?
number
axisLabelStyle.maxWidth?
number
axisLabelStyle.padding?
number
crossStyle?
{ opacity?: number; strokeDasharray?: string; strokeWidth?: number; strokeX?: string; strokeY?: string; }
Style of the crosses: the colors of the vertical and horizontal ones, the width, the dash and the opacity.
crossStyle.opacity?
number
crossStyle.strokeDasharray?
string
crossStyle.strokeWidth?
number
crossStyle.strokeX?
string
crossStyle.strokeY?
string
showAxisLabels?
boolean
Whether a label with the value under the pointer is drawn on each axis (default true). A long label wraps within the room its axis leaves.
showCrossX?
boolean
Whether the vertical cross (the X position) is drawn (default true).
showCrossY?
boolean
Whether the horizontal cross (the Y position) is drawn (default true).
valueFormatter?
(axis, value, defaultFormatter) => string
Custom label text: receives the axis, the value and the default formatter.
Returns
void
Constructors
Constructor
ts
new D3PCursorIndicator(opts?): D3PCursorIndicator;Defined in: core/cursor.ts:80
Parameters
opts?
D3PCursorIndicatorOptions = {}
Returns
D3PCursorIndicator
Overrides
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
Returns
void
Inherited from
attached()
ts
protected attached(
chart,
_data,
subs
): void;Defined in: core/cursor.ts:101
Subscribe / create DOM. Subscriptions added to subs are released on detach.
Parameters
chart
_data
CursorData
subs
Returns
void
Overrides
createData()
ts
protected createData(chart): CursorData;Defined in: core/cursor.ts:95
Build the per-chart record. Must not rely on other objects of the chart.
Parameters
chart
Returns
CursorData
Overrides
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
detached()
ts
protected detached(_chart, data): void;Defined in: core/cursor.ts:119
DOM / registry cleanup (subscriptions are released afterwards).
Parameters
_chart
data
CursorData
Returns
void
Overrides
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
getCharts()
ts
getCharts(): D3PChart[];Defined in: core/object.ts:105
The charts the object is attached to.
Returns
D3PChart[]
Inherited from
hasChart()
ts
hasChart(chart): boolean;Defined in: core/object.ts:110
Whether the object is attached to this chart.
Parameters
chart
Returns
boolean
Inherited from
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
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
Returns
void
Inherited from
render()
ts
render(chart): void;Defined in: core/cursor.ts:125
Draws the crosses and, on each axis, a label with the value under the pointer.
Parameters
chart
Returns
void
Overrides
tagDirty()
ts
tagDirty(chart?): void;Defined in: core/object.ts:119
Schedule a redraw on one chart (or all attached charts).
Parameters
chart?
Returns
void
Inherited from
Properties
axes
ts
readonly axes: D3PAxisFilter | undefined;Defined in: core/cursor.ts:65
The axes the cursor is restricted to, if any.
bus
ts
readonly bus: D3PBus;Defined in: core/object.ts:27
The bus the object uses for its events.
Inherited from
chartData
ts
protected readonly chartData: Map<D3PChart, CursorData>;Defined in: core/object.ts:66
What the object keeps for each chart it is attached to.
Inherited from
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
isDestroying
ts
isDestroying: boolean = false;Defined in: core/object.ts:31
Set when destroy starts: the object is not drawn after that.
Inherited from
subs
ts
protected readonly subs: D3PSubscriptions;Defined in: core/object.ts:33
The subscriptions of the object, released when it is destroyed.