D3 in Ember
@NYCHTML5
Heyjin Kim
Engineer, SimpleReach
@heyjinkim
heyjin@simplereach.com
what is D3?
-
JavaScript Library by Mike Bostock
- Manipulating DOM based on data
- Great Data Visualizations in SVG
-
Data-Driven Documents
data
d3.csv()
d3.tsv()
d3.text()
however,
hard things with d3
Hard things with d3
- Spaghetti Code
- Making Reusable Charts
- Handling SVG with properties
complex application
handling svg with properties
-
A common point of confusion in SVG is distinguishing between properties
that must be specified as attributes and properties that can be set as styles
Let's make them easy
with Ember
what is ember?
-
MVC JavaScript framework
-
by Yehuda Katz and Tom Dale
-
Creating ambitious web applications
made easier with ember
-
Separate Concerns
-
Ember Component
-
Data Bindings & Observers
separate concerns
Easy to maintain the code
D3 code (everything is in one place)
D3 in ember (separate concerns)
Ember component
Easy to make (encapsulated) reusable charts
web component
- To make reusable modular code like widget
- Define your own application-specific HTML tags
then implement their behavior using JavaScript
-
W3C is still working on it!
http://www.w3.org/TR/components-intro
ember component
- Encapsulated d3 code in Ember Component
-
Turn your chart into an HTML tag
Data bindings & observers
Easy to configure properties & update DOM
demo
D3 charts in Ember Components
thank you!
@heyjinkim
http://heyjinjs.us
heyjin@simplereach.com
EMBER
D3