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
310
Other Decks in Programming
See All in Programming
SourceGeneratorのススメ
htkym
0
190
Architectural Extensions
denyspoltorak
0
280
Basic Architectures
denyspoltorak
0
670
AI巻き込み型コードレビューのススメ
nealle
1
170
例外処理とどう使い分ける?Result型を使ったエラー設計 #burikaigi
kajitack
16
6k
Oxlint JS plugins
kazupon
1
890
AI Schema Enrichment for your Oracle AI Database
thatjeffsmith
0
270
AIフル活用時代だからこそ学んでおきたい働き方の心得
shinoyu
0
130
Spinner 軸ズレ現象を調べたらレンダリング深淵に飲まれた #レバテックMeetup
bengo4com
1
230
高速開発のためのコード整理術
sutetotanuki
1
400
MDN Web Docs に日本語翻訳でコントリビュート
ohmori_yusuke
0
650
AgentCoreとHuman in the Loop
har1101
5
230
Featured
See All Featured
Principles of Awesome APIs and How to Build Them.
keavy
128
17k
My Coaching Mixtape
mlcsv
0
47
WCS-LA-2024
lcolladotor
0
450
Claude Code のすすめ
schroneko
67
210k
Designing Powerful Visuals for Engaging Learning
tmiket
0
230
Why Your Marketing Sucks and What You Can Do About It - Sophie Logan
marketingsoph
0
73
What's in a price? How to price your products and services
michaelherold
247
13k
The SEO Collaboration Effect
kristinabergwall1
0
350
Done Done
chrislema
186
16k
From Legacy to Launchpad: Building Startup-Ready Communities
dugsong
0
140
svc-hook: hooking system calls on ARM64 by binary rewriting
retrage
1
99
Between Models and Reality
mayunak
1
180
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/