English
Class: D3PToolbox
Defined in: core/tools/toolbox.ts:29
Registry of named tools over N charts, a subset of which is active. Activating a tool attaches it to every chart of the toolbox; deactivating detaches it.
Extends
D3PObject<{toolStateChanged: {state:boolean;tool:D3PToolLike; }; }>
Accessors
mutuallyExclusiveGroups
Get Signature
ts
get mutuallyExclusiveGroups(): string[][];Defined in: core/tools/toolbox.ts:42
The groups of tool names of which only one is active at a time ([['pan', 'zoom-selection']]).
Returns
string[][]
Constructors
Constructor
ts
new D3PToolbox(opts?): D3PToolbox;Defined in: core/tools/toolbox.ts:36
Parameters
opts?
D3PToolboxOptions = {}
Returns
D3PToolbox
Overrides
Methods
addToChart()
ts
addToChart(chart): void;Defined in: core/tools/toolbox.ts:67
Attaches the toolbox to a chart: the active tools work there.
Parameters
chart
Returns
void
addTool()
ts
addTool(tool): void;Defined in: core/tools/toolbox.ts:53
Adds a tool. Throws an error if a tool has its name. It is not active until setToolActive.
Parameters
tool
Returns
void
deactivateAll()
ts
deactivateAll(): void;Defined in: core/tools/toolbox.ts:105
Deactivates every tool.
Returns
void
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
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
getActiveTool()
ts
getActiveTool(): D3PToolLike | null;Defined in: core/tools/toolbox.ts:114
The first active tool, or null.
Returns
D3PToolLike | null
getActiveTools()
ts
getActiveTools(): D3PToolLike[];Defined in: core/tools/toolbox.ts:119
The tools that are active.
Returns
getTool()
ts
getTool<T>(name): T | undefined;Defined in: core/tools/toolbox.ts:127
The tool of that name, if any.
Type Parameters
T
T extends D3PToolLike = D3PToolLike
Parameters
name
string
Returns
T | undefined
getTools()
ts
getTools(): D3PToolLike[];Defined in: core/tools/toolbox.ts:131
All the tools, active or not.
Returns
hasToolActive()
ts
hasToolActive(): boolean;Defined in: core/tools/toolbox.ts:110
Whether at least one tool is active.
Returns
boolean
isToolActive()
ts
isToolActive(name): boolean;Defined in: core/tools/toolbox.ts:123
Whether the tool of that name is active.
Parameters
name
string
Returns
boolean
onDestroy()
ts
protected onDestroy(): void;Defined in: core/tools/toolbox.ts:135
Hook run first on destroy (detach from partners, release DOM...).
Returns
void
Overrides
removeFromChart()
ts
removeFromChart(chart): void;Defined in: core/tools/toolbox.ts:75
Detaches the toolbox from a chart.
Parameters
chart
Returns
void
removeTool()
ts
removeTool(name): void;Defined in: core/tools/toolbox.ts:59
Removes a tool (and deactivates it).
Parameters
name
string
Returns
void
setMutuallyExclusiveGroups()
ts
setMutuallyExclusiveGroups(groups): void;Defined in: core/tools/toolbox.ts:47
Sets the groups of mutually exclusive tools. Active tools that conflict are deactivated.
Parameters
groups
string[][]
Returns
void
setToolActive()
ts
setToolActive(name, active?): void;Defined in: core/tools/toolbox.ts:85
Activates or deactivates a tool. Activating a tool deactivates the others of its groups. Throws an error for an unknown name.
Parameters
name
string
active?
boolean = true
Returns
void
Properties
bus
ts
readonly bus: D3PBus;Defined in: core/object.ts:27
The bus the object uses for its events.
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.