The number of groups in this selection.
Appends a new child to each node in the selection. This child will inherit the parent's data (if available). Returns a fresh selection consisting of the newly-appended children.
the element name to append. May be prefixed (see d3.ns.prefix).
Appends a new child to each node in the selection by computing a new node. This child will inherit the parent's data (if available). Returns a fresh selection consisting of the newly-appended children.
the function to compute a new element
Retrieve the value of the given attribute for the first node in the selection.
The attribute name to query. May be prefixed (see d3.ns.prefix).
For all nodes, set the attribute to the specified constant value. Use null to remove.
The attribute name, optionally prefixed.
The attribute value to use. Note that this is coerced to a string automatically.
Derive an attribute value for each node in the selection based on bound data.
The attribute name, optionally prefixed.
The function of the datum (the bound data item), index (the position in the subgrouping), and outer index (overall position in nested selections) which computes the attribute value. If the function returns null, the attribute is removed.
Set multiple properties at once using an Object. D3 iterates over all enumerable properties and either sets or computes the attribute's value based on the corresponding entry in the Object.
A key-value mapping corresponding to attributes and values. If the value is a simple string or number, it is taken as a constant. Otherwise, it is a function that derives the attribute value.
Returns true if the first node in this selection has the given class list. If multiple classes are specified (i.e., "foo bar"), then returns true only if all classes match.
The class list to query.
Adds (or removes) the given class list.
The class list to toggle. Spaces separate class names: "foo bar" is a list of two classes.
If true, add the classes. If false, remove them.
Determine if the given class list should be toggled for each node in the selection.
The class list. Spaces separate multiple class names.
The function to run for each node. Should return true to add the class to the node, or false to remove it.
Set or derive classes for multiple class lists at once.
An Object mapping class lists to values that are either plain booleans or functions that return booleans.
Retrieves the data bound to the first group in this selection.
Binds data to this selection.
the array of data to bind to this selection
the optional function to determine the unique key for each piece of data. When unspecified, uses the index of the element.
Derives data to bind to this selection.
the function to derive data. Must return an array.
the optional function to determine the unique key for each data item. When unspecified, uses the index of the element.
Return the data item bound to the first element in the selection.
Set the data item for each node in the selection.
the constant element to use for each node
Derive the data item for each node in the selection. Useful for situations such as the HTML5 'dataset' attribute.
the function to compute data for each node
Invoke the given function for each element in the selection. The return value of the function is ignored.
the function to invoke
Returns true if the current selection is empty.
Returns the placeholder nodes for each data element for which no corresponding DOM element was found.
Returns a selection for those DOM nodes for which no new data element was found.
Filters the selection, returning only those nodes that match the given CSS selector.
the CSS selector
Filters the selection, returning only those nodes for which the given function returned true.
the filter function
Retrieve the HTML content of the first node in the selection. Uses 'innerHTML' internally and will not work with SVG or other elements without a polyfill.
Set the HTML content of every node in the selection. Uses 'innerHTML' internally and thus will not work with SVG or other elements without a polyfill.
the HTML content to use.
Compute the HTML content for each node in the selection. Uses 'innerHTML' internally and thus will not work with SVG or other elements without a polyfill.
the function to compute HTML content
Inserts a new child to each node in the selection. This child will inherit its parent's data (if available). Returns a fresh selection consisting of the newly-inserted children.
the element name to append. May be prefixed (see d3.ns.prefix).
the selector to determine position (e.g., ":first-child")
Inserts a new child to each node in the selection. This child will inherit its parent's data (if available). Returns a fresh selection consisting of the newly-inserted children.
the element name to append. May be prefixed (see d3.ns.prefix).
a function to determine the node to use as the next sibling
Inserts a new child to the end of each node in the selection by computing a new node. This child will inherit its parent's data (if available). Returns a fresh selection consisting of the newly-inserted children.
the function to compute a new child
the selector to determine position (e.g., ":first-child")
Inserts a new child to the end of each node in the selection by computing a new node. This child will inherit its parent's data (if available). Returns a fresh selection consisting of the newly-inserted children.
the function to compute a new child
a function to determine the node to use as the next sibling
Interrupts the active transition of the provided name. Does not cancel scheduled transitions.
the transition name (defaults to "")
Returns the first non-null element in the selection, or null otherwise.
Returns the listener (if any) for the given event.
the type of event to load the listener for. May have a namespace (e.g., ".foo") at the end.
Adds a listener for the specified event. If one was already registered, it is removed before the new listener is added. The return value of the listener function is ignored.
the of event to listen to. May have a namespace (e.g., ".foo") at the end.
an event listener function, or null to unregister
sets the DOM useCapture flag
Reorders nodes in the document to match the selection order. More efficient than calling sort() if the selection is already ordered.
Retrieve an arbitrary node property such as the 'checked' property of checkboxes, or the 'value' of text boxes.
the node's property to retrieve
For each node, set the property value. Internally, this sets the node property directly (e.g., node[name] = value), so take care not to mutate special properties like proto.
the property name
the property value
For each node, derive the property value. Internally, this sets the node property directly (e.g., node[name] = value), so take care not to mutate special properties like proto.
the property name
the function used to derive the property's value
Set multiple node properties. Caveats apply: take care not to mutate special properties like proto.
an Object whose keys correspond to node properties and values are either constants or functions that will compute a value.
Removes the elements from the DOM. They are in a detached state and may be re-added (though there is currently no dedicated API for doing so).
Creates a subselection by finding the first descendent matching the selector string. Bound data is inherited.
the CSS selector to match against
Creates a subselection by using a function to find descendent elements. Bound data is inherited.
the function to find matching descendants
Creates a subselection by finding all descendents that match the given selector. Bound data is not inherited.
the CSS selector to match against
Creates a subselection by using a function to find descendent elements. Bound data is not inherited.
the function to find matching descendents
Returns the total number of elements in the selection.
Reorders nodes in the selection based on the given comparator. Nodes are re-inserted into the document once sorted.
the comparison function, which defaults to d3.ascending
Retrieve the computed style value for the first node in the selection.
The CSS property name to query
Set a style property for all nodes in the selection.
the CSS property name
the property value
if specified, either null or the string "important" (no exclamation mark)
Derive a property value for each node in the selection.
the CSS property name
the function to derive the value
if specified, either null or the string "important" (no exclamation mark)
Set a large number of CSS properties from an object.
an Object whose keys correspond to CSS property names and values are either constants or functions that derive property values
if specified, either null or the string "important" (no exclamation mark)
Retrieve the textContent of the first node in the selection.
Set the textContent of each node in the selection.
the text to use for all nodes
Compute the textContent of each node in the selection.
the function which will compute the text
Begins a new transition. Interrupts any active transitions of the same name.
the transition name (defaults to "")
Generated using TypeDoc
Retrieve a grouped selection.