Lock in $30 Savings on PRO—Offer Ends Soon! ⏳
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Composing data visualizations in Ember
Search
Chris Henn
March 03, 2015
Technology
0
960
Composing data visualizations in Ember
Chris Henn
March 03, 2015
Tweet
Share
Other Decks in Technology
See All in Technology
第4回 「メタデータ通り」 リアル開催
datayokocho
0
120
re:Inventで気になったサービスを10分でいけるところまでお話しします
yama3133
1
120
ログ管理の新たな可能性?CloudWatchの新機能をご紹介
ikumi_ono
1
550
Security Diaries of an Open Source IAM
ahus1
0
130
Snowflakeでデータ基盤を もう一度作り直すなら / rebuilding-data-platform-with-snowflake
pei0804
3
850
因果AIへの招待
sshimizu2006
0
930
Karate+Database RiderによるAPI自動テスト導入工数をCline+GitLab MCPを使って2割削減を目指す! / 20251206 Kazuki Takahashi
shift_evolve
PRO
1
570
Haskell を武器にして挑む競技プログラミング ─ 操作的思考から意味モデル思考へ
naoya
5
970
RAG/Agent開発のアップデートまとめ
taka0709
0
140
A Compass of Thought: Guiding the Future of Test Automation ( #jassttokai25 , #jassttokai )
teyamagu
PRO
1
250
多様なデジタルアイデンティティを攻撃からどうやって守るのか / 20251212
ayokura
0
330
チーリンについて
hirotomotaguchi
3
1.3k
Featured
See All Featured
The Art of Programming - Codeland 2020
erikaheidi
56
14k
How STYLIGHT went responsive
nonsquared
100
6k
Measuring & Analyzing Core Web Vitals
bluesmoon
9
700
How to Ace a Technical Interview
jacobian
280
24k
Dealing with People You Can't Stand - Big Design 2015
cassininazir
367
27k
Java REST API Framework Comparison - PWX 2021
mraible
34
9k
Refactoring Trust on Your Teams (GOTO; Chicago 2020)
rmw
35
3.3k
"I'm Feeling Lucky" - Building Great Search Experiences for Today's Users (#IAC19)
danielanewman
231
22k
Making Projects Easy
brettharned
120
6.5k
Writing Fast Ruby
sferik
630
62k
Fight the Zombie Pattern Library - RWD Summit 2016
marcelosomers
234
17k
BBQ
matthewcrist
89
9.9k
Transcript
Composing Data Visualizations in Ember Chris Henn · chnn/composing-graphics
How should we split a statistical graphic into parts?
• Lets us change one feature of the graphic at
a time • Suggests the aspects of a plot that are possible to change • Encourages custom visualizations for every data situation
mpg cyl disp hp drat wt qsec vs am gear
carb Mazda RX4 21.0 6 160.0 110 3.90 2.620 16.46 0 1 4 4 Mazda RX4 Wag 21.0 6 160.0 110 3.90 2.875 17.02 0 1 4 4 Datsun 710 22.8 4 108.0 93 3.85 2.320 18.61 1 1 4 1 Hornet 4 Drive 21.4 6 258.0 110 3.08 3.215 19.44 1 0 3 1 Hornet Sportabout 18.7 8 360.0 175 3.15 3.440 17.02 0 0 3 2 Valiant 18.1 6 225.0 105 2.76 3.460 20.22 1 0 3 1 …
[ {name: “Mazda RX4”, mpg: 21.0, wgt: 2.62, cyl: 6,
…}, {name: “Mazda RX4 Wag”, mpg: 21.0, wgt: 2.875, cyl: 6, …}, {name: “Datsun 710”, mpg: 22.8, wgt: 2.32, cyl: 4, …}, … ]
Demo
Hadley Wickham’s Grammar of Graphics
A simple scatterplot
A simple scatterplot • Mappings from variables to aspects of
the plot • In the grammar this is a data to aesthetic mapping • Every visualization has at least one (often more)
A simple scatterplot • Each Data to Aesthetic mapping has
some mapping function • These are called scales
A simple scatterplot • We’ve chosen to represent these as
points • This is called a geom (or geometry)
The Grammar of Graphics • Data to Aesthetic mappings •
Scales: one per Data to Aesthetic mapping • Layers A. Geom B. Stat C. Optional Data to Aesthetic mapping • Coordinate System • Faceting
What does this look like using Ember?
Data to Aesthetic Mappings
{{my-scatterplot data=app.carData y="mpg" x="wt" color="cyl"}} Data to Aesthetic Mappings
Scales
// Some scale constructor var scale = linearScale([0, 10], [0,
300]); scale(5) // => 150 scale.invert(150) // => 5 Scales
var SomeComponent = Ember.Component.extend({ // Computed property that returns a
scale function xScale: linearScaleMacro('data', 'x', ‘screenWidth'), // ... }); Scales
Layers Geometries, Stats, Optional Data to Aesthetic mappings
{{plot-points data=data x=x y=y xScale=xScale yScale=yScale}} Layers
<svg> <path d="{{pathString}}" /> </svg> Layers: Geometries
<svg> {{#each points as |point|}} <circle cx="{{point.x}}" cy=“{{point.y}}" /> {{/each}}
</svg> Layers: Geometries
Further considerations • Interactivity • Animations and transitions • Performance
• When is the grammar appropriate?
When is the Grammar of Graphics appropriate? General Purpose Plotting
Library App with one visualization Your Ember App
Questions? chrishenn.net twitter: @cwhnn github: @chnn