22721156bf | ||
---|---|---|
test | ||
.gitignore | ||
.npmignore | ||
LICENSE | ||
README.md | ||
d3.sublime-project | ||
index.js | ||
package.json | ||
rollup.config.js |
README.md
d3
This branch contains the prerelease of D3 4.0. This API is unstable and may change at any point prior to the release!
…
Installing
If you use NPM, npm install d3
. Otherwise, download the latest release. The released bundle supports AMD, CommonJS, and vanilla environments. Create a custom build using Rollup or your preferred bundler. You can also load directly from d3js.org:
<script src="https://d3js.org/d3.v4pre.min.js"></script>
API Reference
- Arrays (Statistics, Search, Transformations, Objects, Maps, Sets, Nests, Histograms)
- Colors
- Delimiter-Separated Values
- Easing Functions
- Events
Arrays
Array manipulation, ordering, searching, summarizing, etc.
Statistics
Methods for computing basic summary statistics.
- d3.min - compute the minimum value in an array.
- d3.max - compute the maximum value in an array.
- d3.extent - compute the minimum and maximum value in an array.
- d3.sum - compute the sum of an array of numbers.
- d3.mean - compute the arithmetic mean of an array of numbers.
- d3.median - compute the median of an array of numbers (the 0.5-quantile).
- d3.quantile - compute a quantile for a sorted array of numbers.
- d3.variance - compute the variance of an array of numbers.
- d3.deviation - compute the standard deviation of an array of numbers.
Search
Methods for searching arrays for a specific element.
- d3.scan - linear search for an element using a comparator.
- d3.bisect - binary search for a value in a sorted array.
- d3.bisectRight - binary search for a value in a sorted array.
- d3.bisectLeft - binary search for a value in a sorted array.
- d3.bisector - bisect using an accessor or comparator.
- d3.ascending - compute the natural order of two values.
- d3.descending - compute the natural order of two values.
Transformations
Methods for transforming arrays and for generating new arrays.
- d3.merge - merge multiple arrays into one array.
- d3.pairs - returns an array of adjacent pairs of elements.
- d3.permute - reorder an array of elements according to an array of indexes.
- d3.shuffle - randomize the order of an array.
- d3.ticks - generate representative values from a numeric interval.
- d3.tickStep - generate representative values from a numeric interval.
- d3.range - generate a range of numeric values.
- d3.transpose - transpose an array of arrays.
- d3.zip - transpose a variable number of arrays.
Objects
Methods for converting associative arrays (objects) to arrays.
- 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.
Maps
Like ES6 Map, but with string keys and a few other differences.
- d3.map - constructs a new, empty map.
- map.has - returns true if the map contains the given key.
- map.get - returns the value for the given key.
- map.set - sets the value for the given key.
- map.remove - removes the entry for given key.
- map.clear - removes all entries.
- map.keys - returns the map’s array of keys.
- map.values - returns the map’s array of values.
- map.entries - returns the map’s array of entries (key-values objects).
- map.each - calls the given function for each entry in the map.
- map.empty - returns false if the map has at least one entry.
- map.size - returns the number of entries in the map.
Sets
Like ES6 Set, but with string keys and a few other differences.
- d3.set - constructs a new, empty set.
- set.has - returns true if the set contains the given value.
- set.add - adds the given value.
- set.remove - removes the given value.
- set.clear - removes all values.
- set.values - returns the set’s array of values.
- set.each - calls the given function for each value in the set.
- set.empty - returns true if the set has at least one value.
- set.size - returns the number of values in the set.
Nests
Group data into arbitrary hierarchies.
- d3.nest - constructs a new nest generator.
- 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 - generate the nest, returning a map.
- nest.object - generate the nest, returning an associative array.
- nest.entries - generate the nest, returning an array of key-values tuples.
Histograms
Bin discrete samples into continuous, non-overlapping intervals.
- d3.histogram - constructs a new histogram generator.
- histogram - compute the histogram for the given array of samples.
- histogram.value - specify a value accessor for each sample.
- histogram.domain - specify the interval of observable values.
- histogram.thresholds - specify how values are divided into bins.
- d3.thresholdFreedmanDiaconis - the Freedman–Diaconis binning rule.
- d3.thresholdScott - Scott’s normal reference binning rule.
- d3.thresholdSturges - Sturge’s binning formula.
Colors
Color manipulation and color space conversion.
- d3.color - parses the given CSS color specifier.
- color.rgb - returns the RGB equivalent of this color.
- color.brighter - returns a brighter copy of this color.
- color.darker - returns a darker copy of this color.
- color.displayable - returns true if the color is displayable on standard hardware.
- color.toString - formats the color as an RGB hexadecimal string.
- d3.rgb - constructs a new RGB color.
- d3.hsl - constructs a new HSL color.
- d3.lab - constructs a new Lab color.
- d3.hcl - constructs a new HCL color.
- d3.cubehelix - constructs a new Cubehelix color.
Delimiter-Separated Values
Parse and format delimiter-separated values, most commonly CSV and TSV.
- d3.dsv - constructs a new parser and formatter for the given delimiter.
- dsv.parse - parse the given string, returning an array of objects.
- dsv.parseRows - parse the given string, returning an array of rows.
- dsv.format - format the given array of objects.
- dsv.formatRows - format the given array of rows.
- d3.csv - a parser and formatter for comma-separated values (CSV).
- d3.tsv - a parser and formatter for tab-separated values (TSV).
Easing Functions
- d3.easeBind - bind optional parameters to the given easing function.
- d3.easeLinearIn - linear easing; the identity function.
- d3.easeLinearOut - linear easing; the identity function.
- d3.easeLinearInOut - linear easing; the identity function.
- d3.easePolyIn - polynomial easing; raises time to the given power.
- d3.easePolyOut - reverse polynomial easing.
- d3.easePolyInOut - symmetric polynomial easing.
- d3.easeQuadIn - quadratic easing; squares time.
- d3.easeQuadOut - reverse quadratic easing.
- d3.easeQuadInOut - symmetric quadratic easing.
- d3.easeCubicIn - cubic easing; cubes time.
- d3.easeCubicOut - reverse cubic easing.
- d3.easeCubicInOut - symmetric cubic easing.
- d3.easeSinIn - sinusoidal easing.
- d3.easeSinOut - reverse sinusoidal easing.
- d3.easeSinInOut - symmetric sinusoidal easing.
- d3.easeExpIn - exponential easing.
- d3.easeExpOut - reverse exponential easing.
- d3.easeExpInOut - symmetric exponential easing.
- d3.easeCircleIn - circular easing.
- d3.easeCircleOut - reverse circular easing.
- d3.easeCircleInOut - symmetric circular easing.
- d3.easeElasticIn - elastic easing, like a rubber band.
- d3.easeElasticOut - reverse elastic easing.
- d3.easeElasticInOut - symmetric elastic easing.
- d3.easeBackIn - anticipatory easing, like a dancer bending his knees before jumping.
- d3.easeBackOut - reverse anticipatory easing.
- d3.easeBackInOut - symmetric anticipatory easing.
- d3.easeBounceIn - bounce easing, like a rubber ball.
- d3.easeBounceOut - reverse bounce easing.
- d3.easeBounceInOut - symmetric bounce easing.
Events
Separate concerns using named callbacks.
- d3.dispatch - create a custom event dispatcher.
- dispatch.on - register or unregister an event listener.
- dispatch.type - dispatch an event to registered listeners.