D3.js数据可视化

你的淘宝年度消费报告那炫酷的图表一下子让人忘了自己花了多少钱,各大门户网站、媒体都开始大量使用图表,于是乎又有一批工具等待我们学习的路上

什么是D3.js

D3.js(全称:Data-Driven Documents)大概翻译过来就是数据驱动文档,一看到后缀名的.js就放心了,只要你之前有Javascript的语言基础就可以开始D3.js了,其实它就是一个JavaScript库,和jquery一样都是封装好的JS库,只不过作用不同,D3.js主要是做数据可视化的,也就是各种炫酷的图表,比如折线图、弦图、力导向图等等,而jQuery主要是做页面DOM控制、AJAX和动画的。

D3.js和之前用的echarts.js有啥不同

D3.js和echarts.js都是用来生成各类图表的,区别的话可以从使用方法和实现方式上,echart.js是通过canvas来绘制图形具体使用方法是通过echarts.init 方法初始化一个 echarts 实例并通过 setOption 方法生成一个简单的柱状图很轻松搞定。D3.js通过svg来绘制图形,使用时需要先创建画布(svg元素),然后进行各种绘制图形。

从兼容方面对比两者的话,echart.js兼容到IE6及以上的所有主流浏览器,而D3.js兼容IE9及以上以及所有的主流浏览器,如果项目考虑兼容IE6,建议使用echart.js

从学习成本上来说,echart.js是封装好的方法可以直接调用,学习起来更加快速上手,而相对来说D3.js的学习偏底层学习起来成本较大,也正因为如此D3.js也有更大的灵活性,当你需要的图表中echart中找不到时可以来D3中自己搞定

D3.js图表有多炫酷

这里可以看到官方首屏的截图感受下
图片描述

D3.js怎么使用
在D3官网(https://d3js.org/)选择Download the latest version (5.5.0) here点击进行下载,直接将下载的d3.js引入到页面当中或者通过网络连接进行引入
<script src="http://d3js.org/d3.v3.min.js&...; charset="utf-8"></script>.

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
D3.js 4.x Data Visualization - Third Edition by Andrew Rininsland English | 28 Apr. 2017 | ASIN: B01MG90SSJ | 308 Pages | AZW3 | 6.6 MB Key Features Build interactive and rich graphics and visualization using JavaScript`s powerful library D3.js Learn D3 from the ground up, using the all-new version 4 of the library Gain insight into producing high-quality, extensible charts and visualizations using best practices such as writing testable, extensible code and strong typing Book Description Want to get started with impressive interactive visualizations and implement them in your daily tasks? This book offers the perfect solution-D3.js. It has emerged as the most popular tool for data visualization. This book will teach you how to implement the features of the latest version of D3 while writing JavaScript using the newest tools and technique You will start by setting up the D3 environment and making your first basic bar chart. You will then build stunning SVG and Canvas-based data visualizations while writing testable, extensible code,as accurate and informative as it is visually stimulating. Step-by-step examples walk you through creating, integrating, and debugging different types of visualization and will have you building basic visualizations (such as bar, line, and scatter graphs) in no time. By the end of this book, you will have mastered the techniques necessary to successfully visualize data and will be ready to use D3 to transform any data into an engaging and sophisticated visualization. What you will learn Map data to visual elements using D3's scales Draw SVG elements using D3's shape generators Transform data using D3's collection methods Use D3's various layout patterns to quickly generate various common types of chart Write modern JavaScript using ES2017 and Babel Explore the basics of unit testing D3 visualizations using Mocha and Chai Write and deploy a simple Node.js web service to render charts via HTML Canvas Understand what makes a good data visualization and how to use the tools at your disposal to create accurate charts About the Author Andrew Rininsland is a developer and journalist who has spent much of the last half a decade building interactive content for newspapers such as The Financial Times, The Times, Sunday Times, The Economist, and The Guardian. During his 3 years at The Times and Sunday Times, he worked on all kinds of editorial projects, ranging from obituaries of figures such as Nelson Mandela to high-profile, data-driven investigations such as The Doping Scandal the largest leak of sporting blood test data in history. He is currently a senior developer with the interactive graphics team at the Financial Times. Swizec Teller, author of Data Visualization with d3.js, is a geek with a hat. He founded his first start-up at the age of 21 years and is now looking for the next big idea as a full-stack Web generalist focusing on freelancing for early-stage start-up companies. When he isn't coding, he's usually blogging, writing books, or giving talks at various non-conference events in Slovenia and nearby countries. He is still looking for a chance to speak at a big international conference. In November 2012, he started writing Why Programmers Work At Night, and set out on a quest to improve the lives of developers everywhere. Table of Contents Getting Started with D3, ES2017, and Node.js A Primer on DOM, SVG, and CSS Shape Primitives of D3 Making Data Useful Defining the User Experience - Animation and Interaction Hierarchical Layouts of D3 The Other Layouts D3 on the Server with Canvas, Koa 2, and Node.js Having Confidence in Your Visualizations Designing Good Data Visualizations

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值