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
Sponsored
·
SiteGround - Reliable hosting with speed, security, and support you can count on.
→
itszero
July 19, 2015
Programming
2.5k
1
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
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
More Decks by itszero
See All by itszero
Routing OpenStreetMap
itszero
0
1.4k
EcoSec
itszero
1
210
TaipeiFever
itszero
0
330
Other Decks in Programming
See All in Programming
仕様駆動開発の消費期限
watany
20
8.6k
AIを紡ぐPMのお話
swdtkuy
0
110
Built Our Own Background Agent at LayerX
layerx
PRO
10
5.7k
20260722_microCMSで考える、AI時代のコンテンツ運用設計
yosh1
0
420
ドリフトを絶対に許さない(?)CDK運用 / CDK Ops with Zero Tolerance for Drifts (?)
akihisaikeda
1
200
数百円から始めるRuby電子工作
tarosay
0
160
AIが無かった頃の素敵な出会いの話
codmoninc
1
460
Detecting Compromised CI with eBPF and Cilium Tetragon
lizrice
0
210
琵琶湖の水は止められてもNet--HTTPのリトライは止められない / You might be able to stop the water flow of Lake Biwa but you can't stop Net::HTTP retries
luccafort
PRO
0
770
Laravel Boostに学ぶ、AIにPHPを書かせる技術 〜OSSの実装から蒸留するエージェント制御の王道〜
kentaroutakeda
3
710
人間の目はかわらない、だからJPEGは30年もつ
yuzneri
12
19k
自動化したのに回らないテスト運用の壁ーAI時代の品質責任と生産性
mfunaki
1
140
Featured
See All Featured
The Web Performance Landscape in 2024 [PerfNow 2024]
tammyeverts
12
1.3k
Bioeconomy Workshop: Dr. Julius Ecuru, Opportunities for a Bioeconomy in West Africa
akademiya2063
PRO
1
240
How to Grow Your eCommerce with AI & Automation
katarinadahlin
PRO
1
240
Six Lessons from altMBA
skipperchong
29
4.4k
The Limits of Empathy - UXLibs8
cassininazir
1
610
The Success of Rails: Ensuring Growth for the Next 100 Years
eileencodes
47
8.3k
The World Runs on Bad Software
bkeepers
PRO
72
12k
Neural Spatial Audio Processing for Sound Field Analysis and Control
skoyamalab
0
410
How to build an LLM SEO readiness audit: a practical framework
nmsamuel
1
870
Documentation Writing (for coders)
carmenintech
77
5.5k
Fireside Chat
paigeccino
42
4k
Bash Introduction
62gerente
615
220k
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/