Adds all selected elements to the canvas with the given initial attributes.
An attribute dictionary, see ElementSelection.attrs.
A new instance of the current selection with animations disabled, to allow for further attribute initialisation.
Applies a dictionary of attributes to all selected elements.
All attributes correspond to the available methods. Most attribute endpoints can be provided either as a single value, or as partial dictionary in the form:
The whole dictionary, or any of its direct entries, can be provided as an ElementFn.
An attribute dictionary.
Binds the selection to a list of data values. This will determine the data argument to provide whenever an ElementFn is used.
You can also provide a function to map the current data list to a new one.
Either a list of data values (which must have the same length as the number of elements in the selection), or a function which maps the current data list.
A new instance of the current selection bound to the given data.
Sends an event to the client, in the form:
A partial event object.
Configures the duration of all animations triggered by the selection. A duration of 0 will ensure that changes occur immediately. The default duration is usually 0.5.
The animation duration, in seconds.
A new instance of the current selection using the given animation duration.
Configures the ease function used in all animations triggered by the selection. This will affect the way attributes transition from one value to another. More information is available here: https://github.com/d3/d3-ease.
The name of the ease function, based on the functions found in D3. The full list is below:
"linear", "poly", "poly-in", "poly-out", "poly-in-out", "quad", "quad-in", "quad-out", "quad-in-out", "cubic", "cubic-in", "cubic-out", "cubic-in-out", "sin", "sin-in", "sin-out", "sin-in-out", "exp", "exp-in", "exp-out", "exp-in-out", "circle", "circle-in", "circle-out", "circle-in-out", "elastic", "elastic-in", "elastic-out", "elastic-in-out", "back", "back-in", "back-out", "back-in-out", "bounce", "bounce-in", "bounce-out", "bounce-in-out".
A new instance of the current selection using the given animation ease.
Selects a single edge using a (source, target, optional ID) tuple.
The optional ID is used to distinguish multi-edges. The full string ID of the edge will take
the form "source-target(-ID)". If the edge has directed
set to false, 'source' and 'target'
can be provided in any order, as long as they do not contain the "-" character.
When accessing edges using string IDs, e.g. through Canvas.attrs, the following rules apply:
source
/target
attributes.directed
set to false, "target-source(-ID)" will fall back to
"source-target(-ID)".A new selection corresponding to the given edge.
Sets strategy used to calculate edge lengths. Edges can either specify individual length values (see EdgeSelection.length), or have their lengths dynamically calculated with the given strategy, and with an average of Canvas.edgelength.
More information is available at https://github.com/tgdwyer/WebCola/wiki/link-lengths.
The edge length calculation strategy:
length
attribute individually.Sets the average length of all edges. This only applies if Canvas.edgelayout is not "individual". The default average edge length is 70.
The average edge length.
Selects multiple edges using a list of (source, target, optional ID) tuples, see Canvas.edge.
If no list is provided, all existing edges will be selected.
A list of (source, target) or (source, target, ID) tuples.
A new selection corresponding to the given edges.
Returns a new selection through which all attribute changes are temporary. This is typically used to draw attention to a certain element without permanently changing its attributes.
The amount of time attributes should remain 'highlighted', in seconds, before changing back to their original values. Defaults to 0.5.
A new instance of the current selection, where all attribute changes are temporary.
Selects a single canvas label by its ID. Use "*" to select all existing labels.
A label ID.
A new selection corresponding to the given label.
Selects multiple canvas labels using a list of ID values. If no list is provided, all existing labels will be selected.
A list of label IDs.
A new selection corresponding to the given labels.
Adds a message to the current event queue. Together with Canvas.onmessage, this can be used to detect when a queue reaches a certain point in execution.
A message string.
Selects a node by its ID. Use "*" to select all existing nodes.
A node ID. Avoid using the "-" character.
A new selection corresponding to the given node.
Selects multiple nodes using an list of ID values. If no list is provided, all existing nodes will be selected.
A list of node IDs. Avoid using the "-" character.
A new selection corresponding to the given nodes.
Registers a callback function to listen for all dispatched events, see Canvas.dispatch.
This will override the default event handler.
A callback function which receives a partial event object.
Registers a callback function for messages sent by Canvas.message. Use "*" to listen for all messages.
The message to listen for, or "*" to listen for all messages.
A callback function. When using "*", the exact message will be provided as an argument.
Registers a callback function for all events sent back by the client, in the form:
A callback function which receives a partial event object.
Adds a pause to the current event queue. The pause will only start once all previous pauses have finished. This is a shortcut for QueueSelection.pause.
The duration of the pause, in seconds.
Selects a single event queue by its ID. The default queue has ID 0. Use "*" to select all existing queues.
By default, any changes made to the queue (e.g. start/stop) will take place immediately. However, if ElementSelection.withQ was previously called, the changes themselves will be added as events onto the current queue.
A queue ID. Defaults to 0.
A new selection corresponding to the given queue.
Selects multiple event queues using an list of ID values, see Canvas.queue.
If no list is provided, all existing queues will be selected.
A list of queue IDs.
A new selection corresponding to the given queues.
Simulates an event being received from the client, see Canvas.onreceive.
A partial event object.
Removes all selected elements, resetting their attributes and layout state.
Sets the width and height of the canvas.
This will determine the coordinate system, and will update the width
and height
attributes of the main SVG element, unless otherwise specified with
ElementSelection.svgattr. Size is not animated by default.
Sets a custom SVG attribute on the element. The root SVG tag is <shape>
for nodes, <path>
for edges, <text>
for labels, and <svg>
for the canvas.
Note that when using ElementSelection.attrs, SVG attributes should be provided as a
dictionary under the key svgattrs
.
The name of the SVG attribute.
The value of the SVG attribute.
Sets whether or not the selected elements should be visible. In contrast to removing, visibility will not reset attributes or layout state.
Sets the event queue to use for all events triggered by the selection. Each queue handles events independently, and all queues execute in parallel, which enables multiple animations to run simultaneously.
The null
queue is special; all events added to it will execute immediately. The default
queue has ID 0.
The name of the queue. This can be any string or number, or null
for the
immediate queue. Defaults to 0.
A new instance of the current selection using the given queue.
Sets the zoom level of the canvas camera. A zoom level of 2.0 will make objects appear twice as large, 0.5 will make them half as large, etc.
The new zoom level.
Restricts the zoom level of the canvas camera to the given range. The lower bound describes how far out the camera can zoom, while the upper bound describes the maximum enlarging zoom.
The default zoom limit is (0.1, 10).
Sets whether or not zooming requires the ctrl
/cmd
key to be held down. Disabled by
default.
True if the ctrl
/cmd
key is required, false otherwise.
Generated using TypeDoc
An object responsible for rendering the network, storing application state, and dispatching/receiving events.