Methods in D3.js

name of object returns description
append(tagName) EnterSelection Selection Create and append new elements for all the placeholder entries, returning a new selection of the created elements.
append(tagName) Selection Selection Create and append new elements, returning a new selection of them.
attr(name,func) Transition Transition Transition an attribute value based on data.
attr(name,func) Selection Selection Set attribute value from data.
attr(name,value) Transition Transition Transition an attribute to a value.
attr(name,value) Selection Selection Set attribute to a value.
attr(name) Selection Selection Get attribute value.
attrTween(name,tweenCalculator) Transition Transition Transition an attribute between two values.
call(func,[arg1],[arg2],…) Selection Selection Invoke a function, passing the selection and returning it.
call(func,[arg1],[arg2],…) Transition Transition Invoke a function, passing the transition and returning it.
call() Selection Element Find the first DOM element in the selection.
classed(name,setFlag) Selection Selection Add/remove a CSS class from the selection.
classed(name,func) Selection Selection Add/remove a CSS class from the selection based on data.
classed(name) Selection Boolean Check to see if the selection has the specified class.
data(dataCalculator,[keyCalculator]) Selection Selection Set the data array for the selection based on existing data.
data(dataValues,[keyCalculator]) Selection Selection Set the data array for the selection, computing the update, enter, and exit selections.
data() Selection Array Get the data array for the first group in the selection.
datum() Selection Object Return the data associated with the first element in the selection (if any).
datum(func) Selection Selection Set the data associated with elements in the selection based on existing data.
datum(value) Selection Selection Set the data associated with elements in the selection.
delay(delayMS) Transition Transition Specify transition delay for all elements.
delay(delayCalculator) Transition Transition Calculate per-element transition delay.
duration(durationMS) Transition Transition Specify transition duration for all elements.
duration(durationCalculator) Transition Transition Calculate per-element transition duration.
each([type],func) Transition Transition Run a function on each element at the start or end of the transition.
each(func) Selection Selection Call a function for each element in the selection.
ease(easingFunction) Transition Transition Specify a custom easing function for all elements.
ease(easeType,[easeParam1],[easeParam2]) Transition Transition Specify easing method for all elements.
ease(easingType,[easeParam1],[easeParam2]) d3 Function Retrieve a predefined easing function.
empty() EnterSelection Boolean Test if there are any DOM elements in the selection.
empty() Selection Boolean Test if there are any DOM elements in the selection.
enter() Selection EnterSelection Return the array of placeholders for ‘missing’ elements associated with data.
exit() Selection Selection Return the selection of elements no longer associated with data.
html(func) Selection Selection Set the HTML content for elements in the selection based on data.
html() Selection String Get the innerHTML for a DOM element.
html(newHTML) Selection Selection Set the HTML content for elements in the selection.
insert(tagName,beforeSelector) Selection String Create and insert new elements before existing ones, returning a selection of the new elements.
insert(tagName,beforeSelector) EnterSelection String Create and insert new elements before existing ones, returning a selection of the new elements.
mouse(container) d3 Array Find x,y coordinates of the current mouse event relative to a container element.
node() EnterSelection Element Find the first DOM element in the selection.
on(eventName,eventHandler,capturePhase) Selection Selection Retrieve the event listener for an event type.
on(eventName) Selection Selection Retrieve the event listener for an event type.
order() Selection Selection Reorder the elements in the DOM to match the order of elements in the selection.
property(name,value,[priority]) Selection Selection Set a DOM property for elements in the selection.
property(name) Selection String Get the value of a DOM property.
property(name,func) Selection Selection Set a DOM property for elements in the selection based on data.
remove() Transition Transition Remove all elements in the selection from the document at the end of the transition.
remove() Selection Selection Remove all elements in the selection from the document; returns the selection.
select(selectCalculator) Selection Selection Use a function to select a different element for each entry in the selection.
select(selector) d3 Selection Select an element from the current document.
select(selector) Selection Selection Find the first descendant elements of the selection matching a selector.
select(node) d3 Selection Select an element from the current document.
select(selector) Transition Transition Create a sub-transition from the first descendant elements matching a selector.
selectAll(selector) Transition Transition Create a sub-transition from the descendant elements matching a selector.
selectAll(selector) d3 Selection Select multiple elements from the current document.
selectAll(nodes) d3 Selection Select multiple elements from the current document.
selectAll(selectCalculator) Selection Selection Use a function to select multiple elements for each entry in the selection.
selectAll(selector) Selection Selection Select multiple elements for each entry in the selection.
sort(comparator) Selection Selection Sort the order of elements in the selection (and DOM) according to custom criteria.
style(name) Selection String Get the computed value of a CSS style property.
style(name,func,[priority]) Selection Selection Set a CSS style property for elements in the selection based on data.
style(name,value,[priority]) Selection Selection Set a CSS style property for elements in the selection.
style(name,func,[priority]) Transition Transition Transition a CSS style to a new value based on data.
style(name,value,[priority]) Transition Transition Transition a CSS style to a new value.
styleTween(name,tweenCalculator,[priority]) Transition Transition Transition a CSS style between two values.
text(text) Transition Transition Set the text contents to a new value at the start of the transition.
text(func) Selection Selection Set the text content for elements in the selection based on data.
text(newText) Selection Selection Set the text content for elements in the selection.
text() Selection String Get the textContent for a DOM element.
text(func) Transition Transition Set the text contents to a new value at the start of the transition.
touches(container) d3 Array Find multiple x,y coordinates of the current touch events relative to a container element.
transition(selection) d3 Transition Start an animated transition.
transition() Transition Transition Create a new concurrent transition on selection.
transition() Selection Transition Start a new Transition for the selection.
tween(name,tweenCalculator) Transition Transition Create a custom tween operator to run during the transition.