选择添加删除
函数 | 描述 |
---|---|
select | 选择一个元素 |
selectAll | 选择多个元素 |
selection.order | 排列选中元素 |
selection.sort | 基于数据排列 |
selection.filter | 过滤选择 |
selection.empty | 是否为空 |
selection.size | 选中元素的个数 |
selection.enter | 为缺失元素添加占位符 |
selection.exit | 返回不需要的元素 |
selection.html | 设置innerHTML内容 |
selection.append | 追加元素 |
selection.insert | 在元素之前添加元素 |
selection.remove | 删除元素 |
获取数据
函数 | 描述 |
---|---|
selection.attr | 取得或设置属性 |
selection.classed | 设置class属性 |
selection.property | 获得或设置属性值 |
selection.style | 获得或设置元素样式 |
selection.text | 获得或设置元素内容 |
selection.node | 返回选中的第一个节点 |
selection.data | 取得元素数据,计算连接 |
selection.datum | 获得元素数组,不计算连接 |
动画交互
函数 | 描述 |
---|---|
selection.call | 回调函数 |
selection.each | 为每个选中元素调用函数 |
selection.interrupt | 中断过度 |
selection.transition | 开启过度 |
selection.on | 添加监听器 |
参考文献:
https://github.com/d3/d3/wiki/API–%E4%B8%AD%E6%96%87%E6%89%8B%E5%86%8C
mouse