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.3k
EcoSec
itszero
1
190
TaipeiFever
itszero
0
270
Other Decks in Programming
See All in Programming
Tailwind CSSを本気でカスタマイズする方法
fsubal
2
260
StoreKit2によるiOSのアプリ内課金のリニューアル
kangnux
0
100
ONE WEDGE_company_guide
1wedge_one
0
380
What We Can Learn From OSS
inouehi
0
400
両面どころかインフラもTSでできるよ ~ 全方位TypeScriptによるプロダクト開発 ~
myfinder
9
3.2k
TYPO3 v13 – The road to LTS: What's new and new APIs
luisasofie_xoxo
0
180
SpringBoot+MyBatisで例外が出たときどこを見るか
syukai
0
110
1BRC--Nerd Sniping the Java Community
gunnarmorling
0
300
Git Lint
bkuhlmann
4
740
Semantic search with Django and pgvector
pauloxnet
0
240
⼤規模⾔語モデルの拡張(RAG)が 終わったかも知れない件について
nearme_tech
22
15k
今の SmartHR にエンジニアで入社するとどうなるの?
daisukeshinoku
5
4.6k
Featured
See All Featured
Done Done
chrislema
178
15k
4 Signs Your Business is Dying
shpigford
175
21k
A Philosophy of Restraint
colly
196
16k
Into the Great Unknown - MozCon
thekraken
10
980
Scaling GitHub
holman
457
140k
Refactoring Trust on Your Teams (GOTO; Chicago 2020)
rmw
24
2.3k
I Don’t Have Time: Getting Over the Fear to Launch Your Podcast
jcasabona
20
1.6k
KATA
mclloyd
14
12k
Unsuck your backbone
ammeep
662
57k
Practical Orchestrator
shlominoach
181
9.7k
Rails Girls Zürich Keynote
gr2m
91
13k
Dealing with People You Can't Stand - Big Design 2015
cassininazir
356
22k
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/