D3

https://d3js.org/

数据驱动文档显示, 利用 SVG HTML CSS技术。

D3.js is a JavaScript library for manipulating documents based on data. D3 helps you bring data to life using HTML, SVG, and CSS. D3’s emphasis on web standards gives you the full capabilities of modern browsers without tying yourself to a proprietary framework, combining powerful visualization components and a data-driven approach to DOM manipulation.

D3 allows you to bind arbitrary data to a Document Object Model (DOM), and then apply data-driven transformations to the document. For example, you can use D3 to generate an HTML table from an array of numbers. Or, use the same data to create an interactive SVG bar chart with smooth transitions and interaction.

D3 is not a monolithic framework that seeks to provide every conceivable feature. Instead, D3 solves the crux of the problem: efficient manipulation of documents based on data. This avoids proprietary representation and affords extraordinary flexibility, exposing the full capabilities of web standards such as HTML, SVG, and CSS. With minimal overhead, D3 is extremely fast, supporting large datasets and dynamic behaviors for interaction and animation. D3’s functional style allows code reuse through a diverse collection of official and community-developed modules.

https://d3js.org/

绑定数据后, 数据绑定到的DOM, 则进行数据更新。

没有绑定到DOM的数据, 则使用 enter 获得, 可以append增加新的DOM。

对于没有绑定数据的DOM, 使用exit获得, 使用remove删除DOM。

数据绑定可以是多次, 每次绑定后,使用 enter 和 exit 来维护 unmatched object 数据 或者  DOM

exit 需要退出生命周期的元素DOM,

enter 需要进入生命周期的/实例化DOM的数据元素。

// Update…
var p = d3.select("body")
.selectAll("p")
.data([4, 8, 15, 16, 23, 42])
.text(function(d) { return d; }); // Enter…
p.enter().append("p")
.text(function(d) { return d; }); // Exit…
p.exit().remove();

Scott Murray 教程

https://alignedleft.com/tutorials/d3

只有基础知识的介绍, 完成散点图 条形图 的绘制介绍。 其他更多内容需要 购买其写的书最新版。

不过也够了, 对于程序员来说, 最关键的是代码, 和代码的理解过程。下面介绍本书代码, 用功撸过一遍后, 对D3的整体掌握就七七八八了。

D3 Tutorials

  1. About these tutorials
  2. Fundamentals
  3. Setup
  4. Adding elements
  5. Chaining methods
  6. Binding data
  7. Using your data
  8. Drawing divs
  9. The power of data()
  10. An SVG primer
  11. Drawing SVGs
  12. Types of data
  13. Making a bar chart
  14. Making a scatterplot
  15. Scales
  16. Axes
  17. Transitions

Scott Murray 附属代码

https://github.com/alignedleft/d3-book/

目录为:

从 chapter4开始, 到chapter9是上面开源书对应的代码。

后面章节为高级部分,包括事件,交互, 饼图等的画法。

运行方法见上一篇博客的vscode live preview使用。

D3 API

https://github.com/d3/d3/blob/master/API.md

再撸代码过程中,如果遇到API不懂得,可以到官方GITHUB上去查找。

D3 is a collection of modules that are designed to work together; you can use the modules independently, or you can use them together as part of the default build. The source and documentation for each module is available in its repository. Follow the links below to learn more. For changes between major versions, see CHANGES; see also the release notes and the 3.x reference.

D3 uses semantic versioning. The current version is exposed as d3.version.

参考资料:

https://d3js.org/

https://alignedleft.com/tutorials/d3

https://github.com/alignedleft/d3-book/

https://github.com/d3/d3/blob/master/API.md

D3 learning notes的更多相关文章

  1. rt-thread learning notes

    rt-thread learning notes 2018-01-15 > 001 具有相同优先级的线程,每个线程的时间片大小都可以在初始化或创建该线程时指定 rt_thread_t rt_th ...

  2. Mybatis Learning Notes 1

    Mybatis Learning Notes 主要的参考是博客园竹山一叶的Blog,这里记录的是自己补充的内容 实体类属性名和数据库不一致的处理 如果是实体类的结果和真正的数据库的column的名称不 ...

  3. Rust learning notes

    Rust learning notes Rust Version 1.42.0 $ curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs ...

  4. Coursera, Machine Learning, notes

      Basic theory (i) Supervised learning (parametric/non-parametric algorithms, support vector machine ...

  5. 【Learning Notes】线性链条件随机场(CRF)原理及实现

    1. 概述条件随机场(Conditional Random Field, CRF)是概率图模型(Probabilistic Graphical Model)与区分性分类( Discriminative ...

  6. SQL Learning Notes

    Sams Teach Yourself SQL in 10 Minutes

  7. go learning notes

    1)  cgo $go install test.go # command-line-arguments /usr/bin/ld: unrecognized option '--build-id=no ...

  8. Java learning notes (1):Basic Knowlege points

    Basic Knowlege points: 1: it's necessary that there is only one public class in per .java file 2: .j ...

  9. Python Django Learning Notes..

    The first time I came across django was last month.. Since then I was considering it as the better c ...

随机推荐

  1. vsftpd.configro

    mmp卸载了vsftpd后 配置文件没了 安装也没有 留个做备份 嘿嘿 原始的: # Please see vsftpd.conf. for all compiled in defaults. # # ...

  2. app.config的坑

    C# C/S程序一般通过ConfigurationManager类来读取app.config,其中有个坑爹的地方是ConfigurationManager类自带缓存,就如Windows服务来说,除非重 ...

  3. Win7下emacs简单配置

    ;;win7下.emacs在C:\Users\用户名\AppData\Roaming目录下 在.emacs文件中添加 ;; cancel welcome page取消欢迎界面(setq inhibit ...

  4. c语言static关键字的理解

    static 一.概述 在c语言中static恰当的使用能让程序更加完美,细节上的严谨,代码会更好,也更利于程序的维护与扩展. 而static使用灵活,且又有两种完全无关的用法,所以整理总结一下. 二 ...

  5. java的环境变量配置失败(java.exe、javaw.exe、javaws.exe优先级问题冲突)

    前言:首先安装了intelliJ Idea 其次安装了JDK 1.8 配置完三个系统变量后,java和javac执行不通过 配置过程 1.我的电脑(右键)--->属性---->高级---& ...

  6. shiro过滤器详解分析

    (原) shiro最核心的2个操作,一个是登录的实现,一就是过滤器了.登录有时间再补录说明,这里分析下shiro过滤器怎样玩的. 1.目标 这里会按如下顺序逐一看其实原理,并尽量找出其出处. 先看一下 ...

  7. python selenium while 循环

    while True: try: loadmore = browser.find_element_by_xpath('//div[@class="right"]/div[@clas ...

  8. python学习——读取染色体长度(五:从命令行输入染色体长度)

    # 传递命令行参数 # 导入sys模块 import sys print(sys.argv)   命令行操作 python argv.py 10 20 30 40 50 回车输出 ['argv.py' ...

  9. export,export default和import的区别以及用法

    首先要知道export,import ,export default是什么 ES6模块主要有两个功能:export和import export用于对外输出本模块(一个文件可以理解为一个模块)变量的接口 ...

  10. win10下安装ubuntu18.04

    在win10下安装Ubuntu18.04,双系统共存.Ubuntu 18.04 使用的是Gnome桌面. 查看系统的启动模式: Win+R打开运行,输入msinfo32,回车查看系统信息.在BIOS模 ...