d3/README.md

144 строки
9.4 KiB
Markdown
Исходник Обычный вид История

2016-01-02 08:41:20 +03:00
# 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](https://github.com/mbostock/d3/releases/latest). The released bundle supports AMD, CommonJS, and vanilla environments. Create a custom build using [Rollup](https://github.com/rollup/rollup) or your preferred bundler. You can also load directly from [d3js.org](https://d3js.org):
```html
<script src="https://d3js.org/d3.v4pre.min.js"></script>
```
## API Reference
2016-01-05 20:05:07 +03:00
* [Arrays](#arrays) ([Statistics](#statistics), [Search](#search), [Transformations](#transformations), [Objects](#objects), [Maps](#maps), [Sets](#sets), [Nests](#nests), [Histograms](#histograms))
2016-01-05 20:11:28 +03:00
* [Colors](#colors)
2016-01-05 19:55:13 +03:00
2016-01-05 20:12:00 +03:00
## [Arrays](https://github.com/d3/d3-array)
2016-01-05 19:55:13 +03:00
Array manipulation, ordering, searching, summarizing, etc.
2016-01-05 20:12:25 +03:00
#### [Statistics](https://github.com/d3/d3-array#statistics)
2016-01-05 20:05:07 +03:00
Methods for computing basic summary statistics.
2016-01-05 19:55:13 +03:00
* [d3.min](https://github.com/d3/d3-array#min) - compute the minimum value in an array.
* [d3.max](https://github.com/d3/d3-array#max) - compute the maximum value in an array.
* [d3.extent](https://github.com/d3/d3-array#extent) - compute the minimum and maximum value in an array.
* [d3.sum](https://github.com/d3/d3-array#sum) - compute the sum of an array of numbers.
* [d3.mean](https://github.com/d3/d3-array#mean) - compute the arithmetic mean of an array of numbers.
* [d3.median](https://github.com/d3/d3-array#median) - compute the median of an array of numbers (the 0.5-quantile).
* [d3.quantile](https://github.com/d3/d3-array#quantile) - compute a quantile for a sorted array of numbers.
* [d3.variance](https://github.com/d3/d3-array#variance) - compute the variance of an array of numbers.
* [d3.deviation](https://github.com/d3/d3-array#deviation) - compute the standard deviation of an array of numbers.
2016-01-05 20:12:25 +03:00
#### [Search](https://github.com/d3/d3-array#search)
2016-01-05 20:05:07 +03:00
Methods for searching arrays for a specific element.
* [d3.scan](https://github.com/d3/d3-array#scan) - linear search for an element using a comparator.
* [d3.bisect](https://github.com/d3/d3-array#bisect) - binary search for a value in a sorted array.
* [d3.bisectRight](https://github.com/d3/d3-array#bisectRight) - binary search for a value in a sorted array.
* [d3.bisectLeft](https://github.com/d3/d3-array#bisectLeft) - binary search for a value in a sorted array.
* [d3.bisector](https://github.com/d3/d3-array#bisector) - bisect using an accessor or comparator.
* [d3.ascending](https://github.com/d3/d3-array#ascending) - compute the natural order of two values.
* [d3.descending](https://github.com/d3/d3-array#descending) - compute the natural order of two values.
2016-01-05 20:12:25 +03:00
#### [Transformations](https://github.com/d3/d3-array#transformations)
2016-01-05 20:05:07 +03:00
Methods for transforming arrays and for generating new arrays.
2016-01-05 19:55:13 +03:00
* [d3.merge](https://github.com/d3/d3-array#merge) - merge multiple arrays into one array.
* [d3.pairs](https://github.com/d3/d3-array#pairs) - returns an array of adjacent pairs of elements.
* [d3.permute](https://github.com/d3/d3-array#permute) - reorder an array of elements according to an array of indexes.
* [d3.shuffle](https://github.com/d3/d3-array#shuffle) - randomize the order of an array.
* [d3.ticks](https://github.com/d3/d3-array#ticks) - generate representative values from a numeric interval.
* [d3.tickStep](https://github.com/d3/d3-array#tickStep) - generate representative values from a numeric interval.
* [d3.range](https://github.com/d3/d3-array#range) - generate a range of numeric values.
* [d3.transpose](https://github.com/d3/d3-array#transpose) - transpose an array of arrays.
* [d3.zip](https://github.com/d3/d3-array#zip) - transpose a variable number of arrays.
2016-01-05 20:12:25 +03:00
#### [Objects](https://github.com/d3/d3-array#objects)
2016-01-05 20:05:07 +03:00
Methods for converting associative arrays (objects) to arrays.
2016-01-05 19:55:13 +03:00
* [d3.keys](https://github.com/d3/d3-array#keys) - list the keys of an associative array.
* [d3.values](https://github.com/d3/d3-array#values) - list the values of an associated array.
* [d3.entries](https://github.com/d3/d3-array#entries) - list the key-value entries of an associative array.
2016-01-05 20:12:25 +03:00
#### [Maps](https://github.com/d3/d3-array#maps)
2016-01-05 20:05:07 +03:00
Like ES6 Map, but with string keys and a few other differences.
* [d3.map](https://github.com/d3/d3-array#map) - constructs a new, empty map.
2016-01-05 19:55:13 +03:00
* [*map*.has](https://github.com/d3/d3-array#map_has) - returns true if the map contains the specified key.
* [*map*.get](https://github.com/d3/d3-array#map_get) - returns the value for the specified key.
* [*map*.set](https://github.com/d3/d3-array#map_set) - sets the value for the specified key.
* [*map*.remove](https://github.com/d3/d3-array#map_remove) - removes the entry for specified key.
* [*map*.clear](https://github.com/d3/d3-array#map_clear) - removes all entries.
* [*map*.keys](https://github.com/d3/d3-array#map_keys) - returns the maps array of keys.
* [*map*.values](https://github.com/d3/d3-array#map_values) - returns the maps array of values.
* [*map*.entries](https://github.com/d3/d3-array#map_entries) - returns the maps array of entries (key-values objects).
* [*map*.each](https://github.com/d3/d3-array#map_each) - calls the specified function for each entry in the map.
* [*map*.empty](https://github.com/d3/d3-array#map_empty) - returns false if the map has at least one entry.
* [*map*.size](https://github.com/d3/d3-array#map_size) - returns the number of entries in the map.
2016-01-05 20:12:25 +03:00
#### [Sets](https://github.com/d3/d3-array#sets)
2016-01-05 20:05:07 +03:00
Like ES6 Set, but with string keys and a few other differences.
* [d3.set](https://github.com/d3/d3-array#set) - constructs a new, empty set.
2016-01-05 19:55:13 +03:00
* [*set*.has](https://github.com/d3/d3-array#set_has) - returns true if the set contains the specified value.
* [*set*.add](https://github.com/d3/d3-array#set_add) - adds the specified value.
* [*set*.remove](https://github.com/d3/d3-array#set_remove) - removes the specified value.
* [*set*.clear](https://github.com/d3/d3-array#set_clear) - removes all values.
* [*set*.values](https://github.com/d3/d3-array#set_values) - returns the sets array of values.
* [*set*.each](https://github.com/d3/d3-array#set_each) - calls the specified function for each value in the set.
* [*set*.empty](https://github.com/d3/d3-array#set_empty) - returns true if the set has at least one value.
* [*set*.size](https://github.com/d3/d3-array#set_size) - returns the number of values in the set.
2016-01-05 20:12:25 +03:00
#### [Nests](https://github.com/d3/d3-array#nests)
2016-01-05 20:05:07 +03:00
Group data into arbitrary hierarchies.
* [d3.nest](https://github.com/d3/d3-array#nest) - constructs a new nest generator.
2016-01-05 19:55:13 +03:00
* [*nest*.key](https://github.com/d3/d3-array#nest_key) - add a level to the nest hierarchy.
* [*nest*.sortKeys](https://github.com/d3/d3-array#nest_sortKeys) - sort the current nest level by key.
* [*nest*.sortValues](https://github.com/d3/d3-array#nest_sortValues) - sort the leaf nest level by value.
* [*nest*.rollup](https://github.com/d3/d3-array#nest_rollup) - specify a rollup function for leaf values.
2016-01-05 20:05:07 +03:00
* [*nest*.map](https://github.com/d3/d3-array#nest_map) - generate the nest, returning a map.
* [*nest*.object](https://github.com/d3/d3-array#nest_object) - generate the nest, returning an associative array.
* [*nest*.entries](https://github.com/d3/d3-array#nest_entries) - generate the nest, returning an array of key-values tuples.
2016-01-05 20:12:25 +03:00
#### [Histograms](https://github.com/d3/d3-array#histograms)
2016-01-05 20:05:07 +03:00
Bin discrete samples into continuous, non-overlapping intervals.
2016-01-05 19:55:13 +03:00
2016-01-05 20:05:07 +03:00
* [d3.histogram](https://github.com/d3/d3-array#histogram) - constructs a new histogram generator.
2016-01-05 19:55:13 +03:00
* [*histogram*](https://github.com/d3/d3-array#_histogram) - compute the histogram for the given array of samples.
* [*histogram*.value](https://github.com/d3/d3-array#histogram_value) - specify a value accessor for each sample.
* [*histogram*.domain](https://github.com/d3/d3-array#histogram_domain) - specify the interval of observable values.
* [*histogram*.thresholds](https://github.com/d3/d3-array#histogram_thresholds) - specify how values are divided into bins.
* [d3.thresholdFreedmanDiaconis](https://github.com/d3/d3-array#thresholdFreedmanDiaconis) - the Freedman–Diaconis binning rule.
* [d3.thresholdScott](https://github.com/d3/d3-array#thresholdScott) - Scotts normal reference binning rule.
* [d3.thresholdSturges](https://github.com/d3/d3-array#thresholdSturges) - Sturges binning formula.
2016-01-05 20:11:28 +03:00
2016-01-05 20:12:00 +03:00
## [Colors](https://github.com/d3/d3-color)
2016-01-05 20:11:28 +03:00
Color manipulation and color space conversion.
* [color](https://github.com/d3/d3-color#color) - parses the specified CSS color specifier.
* [*color*.rgb](https://github.com/d3/d3-color#color_rgb) - returns the RGB equivalent of this color.
* [*color*.brighter](https://github.com/d3/d3-color#color_brighter) - returns a brighter copy of this color.
* [*color*.darker](https://github.com/d3/d3-color#color_darker) - returns a darker copy of this color.
* [*color*.displayable](https://github.com/d3/d3-color#color_displayable) - returns true if the color is displayable on standard hardware.
* [*color*.toString](https://github.com/d3/d3-color#color_toString) - formats the color as an RGB hexadecimal string.
* [rgb](https://github.com/d3/d3-color#rgb) - constructs a new RGB color.
* [hsl](https://github.com/d3/d3-color#hsl) - constructs a new HSL color.
* [lab](https://github.com/d3/d3-color#lab) - constructs a new Lab color.
* [hcl](https://github.com/d3/d3-color#hcl) - constructs a new HCL color.
* [cubehelix](https://github.com/d3/d3-color#cubehelix) - constructs a new Cubehelix color.