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
Composing data visualizations in Ember
Search
Chris Henn
March 03, 2015
Technology
0
930
Composing data visualizations in Ember
Chris Henn
March 03, 2015
Tweet
Share
Other Decks in Technology
See All in Technology
UI State設計とテスト方針
rmakiyama
2
440
複雑性の高いオブジェクト編集に向き合う: プラガブルなReactフォーム設計
righttouch
PRO
0
110
社内イベント管理システムを1週間でAKSからACAに移行した話し
shingo_kawahara
0
180
統計データで2024年の クラウド・インフラ動向を眺める
ysknsid25
2
840
Oracle Cloud Infrastructure:2024年12月度サービス・アップデート
oracle4engineer
PRO
0
170
第3回Snowflake女子会_LT登壇資料(合成データ)_Taro_CCCMK
tarotaro0129
0
180
Microsoft Azure全冠になってみた ~アレを使い倒した者が試験を制す!?~/Obtained all Microsoft Azure certifications Those who use "that" to the full will win the exam! ?
yuj1osm
2
110
AIのコンプラは何故しんどい?
shujisado
1
190
KnowledgeBaseDocuments APIでベクトルインデックス管理を自動化する
iidaxs
1
260
LINEヤフーのフロントエンド組織・体制の紹介【24年12月】
lycorp_recruit_jp
0
530
Snowflake女子会#3 Snowpipeの良さを5分で語るよ
lana2548
0
230
kargoの魅力について伝える
magisystem0408
0
200
Featured
See All Featured
Building an army of robots
kneath
302
44k
[RailsConf 2023] Rails as a piece of cake
palkan
53
5k
A Modern Web Designer's Workflow
chriscoyier
693
190k
JavaScript: Past, Present, and Future - NDC Porto 2020
reverentgeek
47
5.1k
Code Review Best Practice
trishagee
65
17k
Fashionably flexible responsive web design (full day workshop)
malarkey
405
66k
Code Reviewing Like a Champion
maltzj
520
39k
Visualizing Your Data: Incorporating Mongo into Loggly Infrastructure
mongodb
44
9.3k
How to train your dragon (web standard)
notwaldorf
88
5.7k
StorybookのUI Testing Handbookを読んだ
zakiyama
27
5.3k
Adopting Sorbet at Scale
ufuk
73
9.1k
RailsConf & Balkan Ruby 2019: The Past, Present, and Future of Rails at GitHub
eileencodes
132
33k
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