d3 v5 api select

https://github.com/d3/d3/blob/master/API.md#selections-d3-selection

Selecting Elements(选择元素) 描述 英文
d3.selection 选择根节点 select the root document element.
d3.select 选择一个节点 select an element from the document.
d3.selectAll 选择多个节点 select multiple elements from the document.
selection.select 从已选择节点继续选择 select a descendant element for each selected element.
selection.selectAll 从已选择节点继续选择 select multiple descendants for each selected element.
selection.filter 通过数据过滤节点 filter elements based on data.
selection.merge 合并选择 merge this selection with another.
d3.matcher 查看是否满足标签 test whether an element matches a selector.
d3.selector 创建一个选择对象(参数),一般直接传入标签名,不需要此步 select an element.
d3.selectorAll 创建多个选择对象(参数) select elements.
d3.window get a node’s owner window. get a node’s owner window.
d3.style get a node’s current style value. get a node’s current style value.
Modifying Elements(更新元素)
selection.attr 获得或设置一个属性(attribute) get or set an attribute.
selection.classed 获得,添加或去除’class’属性 get, add or remove CSS classes.
selection.style 获得或设置一个样式 get or set a style property.
selection.property 获得或设置一个属性(property) get or set a (raw) property.
selection.text 获得或设置标签内容 get or set the text content.
selection.html 获得或设置标签内html get or set the inner HTML.
selection.append 创建,追加或选择新的元素 create, append and select new elements.
selection.insert 创建,插入或选择新的元素 create, insert and select new elements.
selection.remove 移除元素 remove elements from the document.
selection.clone 插入克隆元素 insert clones of selected elements.
selection.sort 排序 sort elements in the document based on data.
selection.order 根据选择重新排序 reorders elements in the document to match the selection.
selection.raise reorders each element as the last child of its parent. reorders each element as the last child of its parent.
selection.lower create and select a detached element. reorders each element as the first child of its parent.
d3.create create and select a detached element. create and select a detached element.
d3.creator create an element by name. create an element by name.
Joining Data(插入数据)
selection.data join elements to data. join elements to data.
selection.enter 获得enter选择结果 get the enter selection (data missing elements).
selection.exit 获得exit选择结果 get the exit selection (elements missing data).
selection.datum 获得或设置标签数据 get or set element data (without joining).
Handling Events(处理事件)
selection.on 添加或移除时间监听 add or remove event listeners.
selection.dispatch dispatch a custom event. dispatch a custom event.
d3.event the current user event, during interaction. the current user event, during interaction.
d3.customEvent temporarily define a custom event. temporarily define a custom event.
d3.mouse 通过给出的容器获得鼠标的位置 get the mouse position relative to a given container.
d3.touch 通过给出的容器获得点击的位置 get a touch position relative to a given container.
d3.touches 通过给出的容器获得点击的位置 get the touch positions relative to a given container.
d3.clientPoint get a position relative to a given container. get a position relative to a given container.
Control Flow(控制流)
selection.each 对每一个元素作用一个函数 call a function for each element.
selection.call 作用一个函数 call a function with this selection.
selection.empty 如果为空返回true returns true if this selection is empty.
selection.nodes 返回选择的所有节点 returns an array of all selected elements.
selection.node 返回选择的第一个节点 returns the first (non
selection.size 返回选择的元素个数 returns the count of elements.
Local Variables(本地变量)
d3.local declares a new local variable. declares a new local variable.
local.set set a local variable’s value. set a local variable’s value.
local.get get a local variable’s value. get a local variable’s value.
local.remove delete a local variable. delete a local variable.
local.toString get the property identifier of a local variable. get the property identifier of a local variable.
Namespaces(命名空间)
d3.namespace qualify a prefixed XML name, such as “xlink:href”. qualify a prefixed XML name, such as “xlink:href”.
d3.namespaces the built the built

你可能感兴趣的:(D3)