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
320
Other Decks in Programming
See All in Programming
[2026年度第1回ORセミナー] 計画最適化ベンチャーと競技プログラミング人材
terryu16
0
280
AI時代のUIはどこへ行く?その2!
yusukebe
22
7.7k
Oxcを導入して開発体験が向上した話
yug1224
4
370
AI がコードを書く時代における新卒エンジニアの仕事風景 (2026) / New Graduate Engineers in the Era of AI Coding (2026)
sushichan044
0
180
LLM本来の能力を解き放つサンドボックス技術とAI民主化への適用
yukukotani
3
4.7k
気づいたらRubyで100作品 ー クリエイティブコーディングが生活の一部になるまで / 100 Ruby Sketches Later: How Creative Coding Became Part of My Life
chobishiba
3
630
例外の正しい扱い方 そのエラー try-catchして大丈夫?
jinwatanabe
0
310
どこまでゆるくて許されるのか
tk3fftk
0
290
A2UI という光を覗いてみる
satohjohn
1
170
ローカルLLMでどこまでコードが書けるか -縮小版 / How much code can be written on a local LLM Shortened
kishida
2
160
ランチタイムLT会3周年!ランチタイムLT会を3年間続けられたお話
y0hgi
1
120
はてなアカウント基盤 State of the Union
cockscomb
1
1.2k
Featured
See All Featured
SEOcharity - Dark patterns in SEO and UX: How to avoid them and build a more ethical web
sarafernandez
0
220
Impact Scores and Hybrid Strategies: The future of link building
tamaranovitovic
0
320
[RailsConf 2023] Rails as a piece of cake
palkan
59
6.7k
Mobile First: as difficult as doing things right
swwweet
225
10k
Collaborative Software Design: How to facilitate domain modelling decisions
baasie
1
260
Designing Dashboards & Data Visualisations in Web Apps
destraynor
231
55k
Improving Core Web Vitals using Speculation Rules API
sergeychernyshev
21
1.5k
Become a Pro
speakerdeck
PRO
31
6k
The browser strikes back
jonoalderson
0
1.3k
Responsive Adventures: Dirty Tricks From The Dark Corners of Front-End
smashingmag
254
22k
<Decoding/> the Language of Devs - We Love SEO 2024
nikkihalliwell
1
270
More Than Pixels: Becoming A User Experience Designer
marktimemedia
3
460
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/