1.对象(Object)
方法 | 描述 |
---|---|
d3.keys(object) | 获得对象的key |
d3.values(object) | 获得对象的value |
d3.entries(object) | 获得对象的key和value |
2.Map
方法 | 描述 |
---|---|
d3.map([object[, key]]) | 创建map,可以将数组传入,然后根据key 参数方法指定key |
map.has(key) | returns true if the map contains the given key. |
map.get(key) | get the value for the given key. |
map.set(key, value) | set the value for the given key. |
map.remove(key) | remove the entry for given key. |
map.clear() | remove all entries. |
map.keys() | get the array of keys. |
map.values() | get the array of values. |
map.entries() | get the array of entries (key-values objects). |
map.each(function) | call a function for each entry. |
map.empty() | returns false if the map has at least one entry. |
map.size() | compute the number of entries. |
3.Sets
方法 | 描述 |
---|---|
d3.set | create a new, empty set. |
set.has | returns true if the set contains the given value. |
set.add | add the given value. |
set.remove | remove the given value. |
set.clear | remove all values. |
set.values | get the array of values. |
set.each | call a function for each value. |
set.empty | returns true if the set has at least one value. |
set.size | compute the number of values. |
4.Nest
方法 | 描述 |
---|---|
d3.nest() | create a new nest generator. |
nest.key(key) | add a level to the nest hierarchy. |
nest.sortKeys(comparator) | sort the current nest level by key. |
nest.sortValues(comparator) | sort the leaf nest level by value. |
nest.rollup(function) | specify a rollup function for leaf values. |
nest.map(array) | generate the nest, returning a map. |
nest.object(array) | generate the nest, returning an associative array. |
nest.entries(array) | generate the nest, returning an array of key-values tuples. |