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
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
Lambda のコードストレージ容量に気をつけましょう
tattwan718
0
120
izumin5210のプロポーザルのネタ探し #tskaigi_msup
izumin5210
1
110
なぜSQLはAIぽく見えるのか/why does SQL look AI like
florets1
0
450
AI によるインシデント初動調査の自動化を行う AI インシデントコマンダーを作った話
azukiazusa1
1
720
「ブロックテーマでは再現できない」は本当か?
inc2734
0
970
Honoを使ったリモートMCPサーバでAIツールとの連携を加速させる!
tosuri13
1
180
SourceGeneratorのススメ
htkym
0
190
Rust 製のコードエディタ “Zed” を使ってみた
nearme_tech
PRO
0
170
Amazon Bedrockを活用したRAGの品質管理パイプライン構築
tosuri13
4
480
コマンドとリード間の連携に対する脅威分析フレームワーク
pandayumi
1
450
CSC307 Lecture 05
javiergs
PRO
0
500
dchart: charts from deck markup
ajstarks
3
990
Featured
See All Featured
Building a A Zero-Code AI SEO Workflow
portentint
PRO
0
310
Navigating Weather and Climate Data
rabernat
0
100
Exploring anti-patterns in Rails
aemeredith
2
250
SEO for Brand Visibility & Recognition
aleyda
0
4.2k
Building Applications with DynamoDB
mza
96
6.9k
For a Future-Friendly Web
brad_frost
182
10k
The agentic SEO stack - context over prompts
schlessera
0
630
Building an army of robots
kneath
306
46k
Git: the NoSQL Database
bkeepers
PRO
432
66k
How to optimise 3,500 product descriptions for ecommerce in one day using ChatGPT
katarinadahlin
PRO
0
3.4k
Site-Speed That Sticks
csswizardry
13
1.1k
Automating Front-end Workflow
addyosmani
1371
200k
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/