D3 Selections

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

1.Selecting Elements

方法描述
d3.selection()select the root document element.
d3.select(selector)选择
d3.selectAll(selector)选择
selection.select(selector)后代选择
selection.selectAll(selector)后代选择
selection.filter(filter)过滤选择
selection.merge(other)合并选择
d3.matcher(selector)判断是否匹配,一般不考虑,filter自带
d3.selector(selector)一般不考虑,select自带
d3.selectorAllselect elements.
d3.window(node)get a node’s owner window.
d3.style(node, name)get a node’s current style value.

2.Modifying Elements

方法描述
selection.attr(name[, value])获得或设置属性
selection.classed(names[, value])get, add or remove CSS classes.
selection.style(name[, value[, priority]])get or set a style property.
selection.property(name[, value])get or set a (raw) property.
selection.text([value])get or set the text content.
selection.html([value])get or set the inner HTML.
selection.append(type)create, append and select new elements.
selection.insert(type[, before])create, insert and select new elements.
selection.remove()remove elements from the document.
selection.clone([deep])insert clones of selected elements.
selection.sort(compare)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.
selection.lower()reorders each element as the first child of its parent.
d3.create(name)不常用,append自动使用
d3.creator(name)create an element by name.

3.Joining Data

方法描述
selection.databind elements to data.
selection.join整合enter exit和update
selection.enterget the enter selection (data missing elements).
selection.exitget the exit selection (elements missing data).
selection.datumget or set element data (without joining).

4.Handling Events

方法描述
selection.onadd or remove event listeners.
selection.dispatchdispatch a custom event.
d3.eventthe current user event, during interaction.
d3.customEventtemporarily define a custom event.
d3.mouseget the mouse position relative to a given container.
d3.touchget a touch position relative to a given container.
d3.touchesget the touch positions relative to a given container.
d3.clientPointget a position relative to a given container.

5.Control Flow

方法描述

selection.each - call a function for each element.
selection.call - call a function with this selection.
selection.empty - returns true if this selection is empty.
selection.nodes - returns an array of all selected elements.
selection.node - returns the first (non-null) element.
selection.size - returns the count of elements.

6.Local Variables

方法描述

d3.local - declares a new local variable.
local.set - set a local variable’s value.
local.get - get a local variable’s value.
local.remove - delete a local variable.
local.toString - get the property identifier of a local variable.

7.Namespaces

方法描述

d3.namespace - qualify a prefixed XML name, such as “xlink:href”.
d3.namespaces - the built-in XML namespaces.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值