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.
Sets alignment of the label's text.
This will affect the direction in which text is appended, as well as its positioning relative to the label's base position. For example, an alignment of "top-left" will ensure that the top left corner of the label is located at the base position.
A special "radial" alignment can be used to dynamically calculate the label's alignment based on its LabelSelection.angle and LabelSelection.rotate attributes, such that text is optimally positioned around an element.
A string describing the alignment, typically in the form "vertical-horizontal". The full list is below:
"top-left", "top-middle", "top-right", "middle-left", "middle", "middle-right", "bottom-left", "bottom-middle", "bottom-right", "radial"
Allows the label to be positioned using polar coordinates, together with the LabelSelection.radius attribute. This will specify the angle, in degrees, along a standard unit circle centered at the label's base position (see LabelSelection.pos).
This will also affect the rotation of the label if LabelSelection.rotate) is enabled.
The polar angle, in degrees, increasing counter-clockwise from the x-axis.
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.
Sets the color of the label's text.
The default color is "gray" in most cases.
A CSS color string.
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.
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.
Sets the font of the label's text.
A CSS font-family string.
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.
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.
Sets the position of the label relative to its parent element.
If the parent is a node, (0,0) will be the node's center. If the parent is an edge connecting two nodes, (0,0) will be the midpoint between the two nodes. If the parent is a looping edge connecting one node, (0,0) will be a point on the node's boundary.
An (x, y) tuple describing the position of the label.
Positions the label using polar coordinates, together with LabelSelection.angle. This will specify the distance from the label's base position (see LabelSelection.pos).
The polar radius, defined as the distance from the label's base position.
Removes all selected elements, resetting their attributes and layout state.
Sets whether the label should be rotated by LabelSelection.angle degrees.
The exact rotation will also depend on the label's alignment. For example, an alignment of "top-center" together with an angle of 90 degrees will result in the text being upside-down.
True if the label should be rotated.
Sets the size of the label's text.
The size of the label's text, in pixels.
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 the text displayed by the label.
The newline character ("\n") can be used to break the text into multiple lines.
The text displayed by the label.
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.
Generated using TypeDoc
A selection of labels.