Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Composing data visualizations in Ember

Sponsored · Your Podcast. Everywhere. Effortlessly. Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.

Composing data visualizations in Ember

Avatar for Chris Henn

Chris Henn

March 03, 2015
Tweet

Other Decks in Technology

Transcript

  1. • 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
  2. 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 …
  3. [ {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, …}, … ]
  4. 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)
  5. A simple scatterplot • Each Data to Aesthetic mapping has

    some mapping function • These are called scales
  6. A simple scatterplot • We’ve chosen to represent these as

    points • This is called a geom (or geometry)
  7. 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
  8. // Some scale constructor var scale = linearScale([0, 10], [0,

    300]); scale(5) // => 150 scale.invert(150) // => 5 Scales
  9. var SomeComponent = Ember.Component.extend({ // Computed property that returns a

    scale function xScale: linearScaleMacro('data', 'x', ‘screenWidth'), // ... }); Scales
  10. When is the Grammar of Graphics appropriate? General Purpose Plotting

    Library App with one visualization Your Ember App