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.selectorAll | select 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.data | bind elements to data. |
selection.join | 整合enter exit和update |
selection.enter | get the enter selection (data missing elements). |
selection.exit | get the exit selection (elements missing data). |
selection.datum | get or set element data (without joining). |
4.Handling Events
方法 | 描述 |
---|---|
selection.on | add or remove event listeners. |
selection.dispatch | dispatch a custom event. |
d3.event | the current user event, during interaction. |
d3.customEvent | 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. |
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.
D3 Selections相关推荐
- Understand Selections in D3
1. How Selection works by Mike Bostock note:this is a great work by Mike. Look carefully and assimil ...
- d3js selections深入理解
D3 selections选择DOM元素以便可以对这些dom元素做相应的操作,比如:更改其style,修改其属性,执行data-join操作,或者插入.删除相应elements 比如,如果给定5个ci ...
- 1897个D3 例子
1.113th U.S. Congressional Districts 2.The Story of the Season 3.20000 points in random motion ...
- D3 JS study notes
如何使用d3来解析自定义格式的数据源? var psv = d3.dsvFormat("|"); // This parser can parse pipe-delimited t ...
- [译] D3.js 嵌套选择集 (Nested Selection)
译者注: 原文: Mike Bostock (D3.js 作者) -- Nested Selections 译者: ssthouse 本文讲解的是关于 D3.js 中 d3-selection 的使用 ...
- [D3] Start Visualizing Data Driven Documents with D3 v4
It's time to live up to D3's true name and potential by integrating some real data into your visuali ...
- 牛逼的js--就是d3.js
d3.js官网:http://d3js.org/ 接触d3.js是因为leader让我研究它并运用到新项目开发中去,所以就花时间了解了一下.写下此文来和大家分享学习,如有不足,欢迎指正. 首先,说下我 ...
- 一个JS框架D3.js
最近有点不务正业,好吧,诚恳一点面对现实.许多时候我想等我把某些问题,完全想明白,完全理解透,再写点东西:事实往往相反,发现等我真正接近,把某些东西理解好,我自己再也不屑写点东西分享了,没有精神气也好 ...
- wps图表中如何插入甘特图_如何通过使用D3可视化数据集来构建类似甘特图的图表...
wps图表中如何插入甘特图 by Déborah Mesquita 由DéborahMesquita 如何通过使用D3可视化数据集来构建类似甘特图的图表 (How to build a Gantt-l ...
最新文章
- Docker与FastDFS的安装命令及使用
- 程序员们请收好这本JVM日历:Java 2018大事回顾
- 移动端https抓包那些事--进阶篇
- 【CDS技术揭秘系列 02】阿里云CDS-SLS大揭秘
- 【Linux】一步一步学Linux——nisdomainname命令(171)
- Winform(C#)输入完毕后,按Enter键触发Button事件
- php获取flash上传视频文件大小,如何获取flash文件(.swf文件)的长度和宽度
- C++20 要来了!
- MySQL初始化安装部署
- 有人回嘴顶撞过驾校教练吗?后果怎样?
- Cuda beginning
- mybatis问题。foreach循环遍历数组报错情况,及其解决方法
- STRING网站分析蛋白质相互作用
- python关键字详解_Python 关键字
- R语言入门——猜数小游戏
- 昊海微信拼团php,最新微信昊海拼团系统独立版源码分享,微信团购关注送红包送优惠卷功能,附说明文档...
- 看了知乎,直呼牛逼 !
- Moore FSM和Mealy FSM的区别
- char类型与varchar类型的区别
- 共鸣(resonance)
热门文章
- html5表单新功能解析,解析HTML5表单新功能-HTML5
- 压测瓶颈在mysql_MySQL的性能基线收集及压力测试
- declare sql语句_SQL语句大全【第二部分】技巧+经典案例
- Python+django网页设计入门(6):文件上传与数据导入
- 两行Python代码实现电影打分与推荐
- Python绘制渐变色三角形
- html中如何实现选择存储路径的功能_Tomcat 路由请求的实现 Mapper
- mysql 分组查询例子_分组查询GROUP BY用法例子详解
- java epoch times_Java 8新特性探究(七)深入解析日期和时间
- C语言char对应的码,char码值对应列表大全