Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
d3.js: the core concepts
Search
itszero
July 19, 2015
Programming
1
2.4k
d3.js: the core concepts
A very introductory view of d3.js, comes with some code example people can play with.
itszero
July 19, 2015
Tweet
Share
More Decks by itszero
See All by itszero
Routing OpenStreetMap
itszero
0
1.4k
EcoSec
itszero
1
200
TaipeiFever
itszero
0
300
Other Decks in Programming
See All in Programming
Combinatorial Interview Problems with Backtracking Solutions - From Imperative Procedural Programming to Declarative Functional Programming - Part 1
philipschwarz
PRO
0
100
TVerのWeb内製化 - 開発スピードと品質を両立させるまでの道のり
techtver
PRO
3
1.2k
CloudNative Days Winter 2025: 一週間で作る低レイヤコンテナランタイム
ternbusty
7
1.7k
CSC509 Lecture 11
javiergs
PRO
0
310
「10分以内に機能を消せる状態」 の実現のためにやっていること
togishima
1
530
Microservices Platforms: When Team Topologies Meets Microservices Patterns
cer
PRO
0
230
Nitro v3
kazupon
2
320
[堅牢.py #1] テストを書かない研究者に送る、最初にテストを書く実験コード入門 / Let's start your ML project by writing tests
shunk031
11
5.5k
仕様がそのままテストになる!Javaで始める振る舞い駆動開発
ohmori_yusuke
8
4.6k
Reactive Thinking with Signals and the new Resource API
manfredsteyer
PRO
0
110
全員アーキテクトで挑む、 巨大で高密度なドメインの紐解き方
agatan
5
8.3k
なぜ強調表示できず ** が表示されるのか — Perlで始まったMarkdownの歴史と日本語文書における課題
kwahiro
12
7.2k
Featured
See All Featured
jQuery: Nuts, Bolts and Bling
dougneiner
65
8k
KATA
mclloyd
PRO
32
15k
The MySQL Ecosystem @ GitHub 2015
samlambert
251
13k
Fashionably flexible responsive web design (full day workshop)
malarkey
407
66k
How STYLIGHT went responsive
nonsquared
100
5.9k
実際に使うSQLの書き方 徹底解説 / pgcon21j-tutorial
soudai
PRO
192
56k
Cheating the UX When There Is Nothing More to Optimize - PixelPioneers
stephaniewalter
285
14k
Creating an realtime collaboration tool: Agile Flush - .NET Oxford
marcduiker
34
2.3k
The Cult of Friendly URLs
andyhume
79
6.7k
[RailsConf 2023] Rails as a piece of cake
palkan
57
6.1k
Building an army of robots
kneath
306
46k
Practical Tips for Bootstrapping Information Extraction Pipelines
honnibal
25
1.6k
Transcript
d3.js: the Core Concepts Zero Cho
data visualization…?
None
so what is D3? d3 is an data visualization library
None
None
Data-Driven Documents notice how visualization is NOT in the title?
[ 1, 2, 3, 4 ] data <div/> <svg/> <canvas/>
HTML/SVG/else
geography time scale color geometry layout behavior data
geography time scale color geometry layout behavior data
step 1: SELECT … just like jQuery
d3.select(‘#ex1') .selectAll('.circle') .style('width', '100px') .style('height', '100px'); code
step 2: BINDING … where magic happens
const data = [50, 100, 200, 300]; const funNumToPx =
(num) => `${num}px`; d3.select(‘#ex2') .selectAll('.circle') .data(data) .style('width', funNumToPx) .style('height', funNumToPx); code http://codepen.io/itszero/pen/LVrwPJ
that’s not dynamic but, you say
given a data, you tell d3 to handle… • enter
• update • exit
let data = []; const count = nextInt(20); for(let i=0;i<count;i++)
{ data.push(nextInt(400)); } const funNumToPx = (num) => `${num}px`; const sel = d3.select('#ex3') .selectAll('.circle') .data(data); sel.enter() .append('div') .attr('class', 'circle'); sel.transition() .duration(500) .style('width', funNumToPx) .style('height', funNumToPx); sel.exit() .remove(); code enter: create basic div exit: remove the div update: update style prep: generate an array of random numbers http://codepen.io/itszero/pen/rVKXMp
now let’s checkout a more advanced example http://codepen.io/itszero/pen/RPBKbj
references • paper • 2011 InfoVis • website (examples) •
http://d3js.org/ • tutorials • https://square.github.io/intro-to-d3/