-
Notifications
You must be signed in to change notification settings - Fork 0
API Reference
mbostock edited this page May 31, 2011
·
151 revisions
Everything in D3 is scoped under the d3 namespace. D3 is broken up into several modules so that you can pick and choose which features you need and minimize the weight. The default build of d3.js includes the core, scale and svg modules, at about 12KB uglified and gzipped. You can edit the Makefile to produce a custom build that suites your needs. D3 does not introduce anything else in the global namespace, with the exception of two polyfills for nonstandard browsers: Date.now and Object.create.
D3 uses semantic versioning. You can find the current version of D3 as d3.version.
- d3.select - select an element from the current document.
- d3.selectAll - select multiple elements from the current document.
- selection.attr - get or set attribute values.
- selection.classed - add or remove CSS classes.
- selection.style - get or set style properties.
- selection.property - get or set raw properties.
- selection.text - get or set text content.
- selection.html - get or set inner HTML content.
- selection.append - create and append new elements.
- selection.insert - create and insert new elements before existing elements.
- selection.remove - remove elements from the document.
- selection.data - bind data to elements, and compute a relational join.
- selection.enter - returns placeholders for missing elements.
- selection.exit - returns elements that are no longer needed.
- selection.filter - filter a selection based on data.
- selection.map - modify the data associated with the selected elements.
- selection.sort - sort elements in the document based on data.
- selection.on - add or remove event listeners for interaction.
- selection.transition - start a transition on the selected elements.
- selection.each - call a function for each selected element.
- selection.call - call a function passing in the current selection.
- selection.empty - returns true if the selection is empty.
- selection.node - access the first node in a selection.
- selection.select - subselect a descendant element for each selected element.
- selection.selectAll - subselect multiple descendants for each selected element.
- d3.event - access the current user event for interaction.
- d3.transition - start an animated transition.
- transition.delay - specify per-element delay in milliseconds.
- transition.duration - specify per-element duration in milliseconds.
- transition.ease - specify transition easing function.
- transition.attr - smoothly transition to the new attribute value.
- transition.attrTween - smoothly transition between two attribute values.
- transition.style - smoothly transition to the new style property value.
- transition.styleTween - smoothly transition between two style property values.
- transition.text - set the text content when the transition starts.
- transition.select - start a transition on a descendant element for each selected element.
- transition.selectAll - start a transition on multiple descendants for each selected element.
- transition.remove - remove selected elements at the end of a transition.
- transition.each - add a listener for transition end events.
- transition.call - call a function passing in the current transition.
- d3.ease - customize transition timing.
- d3.timer - start a custom animation timer.
- d3.timer.flush - immediately execute any zero-delay timers.
- d3.interpolate - interpolate two values.
- d3.interpolateNumber - interpolate two numbers.
- d3.interpolateRound - interpolate two integers.
- d3.interpolateString - interpolate two strings.
- d3.interpolateRgb - interpolate two RGB colors.
- d3.interpolateHsl - interpolate two HSL colors.
- d3.interpolateArray - interpolate two arrays of values.
- d3.interpolateObject - interpolate two arbitrary objects.
- d3.ascending - compare two values for sorting.
- d3.descending - compare two values for sorting.
- d3.min - find the minimum value in an array.
- d3.max - find the maximum value in an array.
- d3.bisect -
- d3.bisectRight -
- d3.bisectLeft -
- d3.permute -
- d3.zip -
- d3.keys - list the keys of an associative array.
- d3.values - list the values of an associated array.
- d3.entries - list the key-value entries of an associative array.
- d3.split - split an array into multiple arrays.
- d3.merge - merge multiple arrays into one array.
- d3.range - generate a range of numeric values.
- d3.nest - group array elements hierarchically.
- nest.key - add a level to the nest hierarchy.
- nest.sortKeys - sort the current nest level by key.
- nest.sortValues - sort the leaf nest level by value.
- nest.rollup - specify a rollup function for leaf values.
- nest.map - evaluate the nest operator, returning an associative array.
- nest.entries - evaluate the nest operator, returning an array of key-values tuples.
-
d3.xhr - request a resource using
XMLHttpRequest. - d3.text - request a text file.
- d3.json - request a JSON blob.
- d3.html - request an HTML document fragment.
- d3.xml - request an XML document fragment.
Also see the CSV module.
- d3.format - format a number as a string.
- d3.requote -
- d3.round -
- d3.rgb - specify a color in RGB space.
- rgb.brighter - increase RGB channels by some exponential factor (gamma).
- rgb.darker - decrease RGB channels by some exponential factor (gamma).
- rgb.hsl - convert from RGB to HSL.
- rgb.toString - convert an RGB color to a string.
- d3.hsl - specify a color in HSL space.
- hsl.brighter - increase lightness by some exponential factor (gamma).
- hsl.darker - decrease lightness by some exponential factor (gamma).
- hsl.rgb - convert from HSL to RGB.
- hsl.toString - convert an HSL color to a string.
- d3.ns.prefix - access or extend known XML namespaces.
- d3.ns.qualify - qualify a prefixed name, such as "xlink:href".
- d3.dispatch - create a custom event dispatcher.
- d3.functor - create a function that returns a constant.
- d3.rebind - rebind an inherited getter/setter method to a subclass.
- d3.scale.linear - construct a linear quantitative scale.
- linear.invert - get the domain value corresponding to a given range value.
- linear.domain - get or set the scale's input domain.
- linear.range - get or set the scale's output range.
- linear.rangeRound - set the scale's output range, and enable rounding.
- linear.interpolate - get or set the scale's output interpolator.
- linear.clamp - enable or disable clamping of the output range.
- linear.ticks - get representative values from the input domain.
- linear.tickFormat - get a formatter for displaying tick values.
- d3.scale.sqrt - construct a quantitative scale with a square root transform.
- d3.scale.pow - construct a quantitative scale with an exponential transform.
- pow.invert - get the domain value corresponding to a given range value.
- pow.domain - get or set the scale's input domain.
- pow.range - get or set the scale's output range.
- pow.rangeRound - set the scale's output range, and enable rounding.
- pow.interpolate - get or set the scale's output interpolator.
- pow.clamp - enable or disable clamping of the output range.
- pow.ticks - get representative values from the input domain.
- pow.tickFormat - get a formatter for displaying tick values.
- pow.exponent - get or set the exponent power.
- d3.scale.log - construct a quantitative scale with an logarithmic transform.
- log.invert - get the domain value corresponding to a given range value.
- log.domain - get or set the scale's input domain.
- log.range - get or set the scale's output range.
- log.rangeRound - set the scale's output range, and enable rounding.
- log.interpolate - get or set the scale's output interpolator.
- log.clamp - enable or disable clamping of the output range.
- log.ticks - get representative values from the input domain.
- log.tickFormat - get a formatter for displaying tick values.
- d3.scale.quantize - construct a linear quantitative scale with a discrete output range.
- quantize.domain - get or set the scale's input domain.
- quantize.range - get or set the scale's output range (as discrete values).
- d3.scale.quantile - construct a quantitative scale mapping to quantiles.
- quantile.domain - get or set the scale's input domain (as discrete values).
- quantile.range - get or set the scale's output range (as discrete values).
- quantile.quantiles - get the scale's quantile bin thresholds.
- d3.scale.ordinal
- ordinal.domain
- ordinal.range
- ordinal.rangePoints
- ordinal.rangeBands
- ordinal.rangeRoundBands
- ordinal.rangeBand
- d3.scale.category10
- d3.scale.category20
- d3.scale.category20b
- d3.scale.category20c
- d3.svg.line
- line.x
- line.y
- line.interpolate
- line.tension
- d3.svg.diagonal
- diagonal.source
- diagonal.target
- diagonal.projection
- d3.svg.chord
- chord.radius
- chord.source
- chord.target
- chord.startAngle
- chord.endAngle
- d3.svg.area
- area.x
- area.y0
- area.y1
- area.interpolate
- area.tension
- d3.svg.arc
- arc.innerRadius
- arc.outerRadius
- arc.startAngle
- arc.endAngle
- arc.centroid
- d3.svg.symbol
- symbol.type
- symbol.size
- d3.layout.force
- force.on
- force.nodes
- force.links
- force.size
- force.distance
- force.drag
- force.charge
- force.gravity
- force.theta
- force.start
- force.resume
- force.stop
- force.drag
- d3.layout.treemap
- treemap.sort
- treemap.children
- treemap.value
- treemap.size
- treemap.round
- treemap.sticky
- d3.layout.chord
- chord.matrix
- chord.padding
- chord.sortGroups
- chord.sortSubgroups
- chord.sortChords
- chord.chords
- chord.groups
- d3.chart.box
- box.width
- box.height
- box.tickFormat
- box.duration
- box.domain
- box.value
- box.whiskers
- box.quartiles
- d3.chart.bullet
- bullet.orient
- bullet.ranges
- bullet.markers
- bullet.measures
- bullet.width
- bullet.height
- bullet.tickFormat
- bullet.duration