SlideShare a Scribd company logo
6

     10


                                       45



20
          Learning D3
          What is d3.js all about?
           And how do I get started?
20

     Scott Murray
     Assistant Professor, Design
     University of San Francisco
45


                                       10

                                   6
What is d3.js?
Learning d3
Learning d3
<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <title>D3 Page Template</title>
  <script type="text/javascript"
          src="d3.v3.js"></script>
</head>
<body>
  <script type="text/javascript">
    // Your beautiful D3 code
    // can go here
  </script>
</body>
</html>
HTML   Hypertext Markup Language

CSS    Cascading Style Sheets

JS     JavaScript

SVG    Scalable Vector Graphics

DOM    The Document Object Model




       all of the above == web standards
HTML       Hypertext Markup Language

CSS        Cascading Style Sheets

JS         JavaScript

SVG        Scalable Vector Graphics

DOM        The Document Object Model




      Learning D3 is a process of “learning the web”
What does data look like on the web?
// JavaScript arrays!

var dataset = [ 5, 10, 20, 15, 18 ];
// Data joins!

var dataset = [ 5, 10, 20, 15, 18 ];

d3.select(“svg”).selectAll(“circle”)
  .data(dataset)
  .enter()
  .append(“circle”);
// Data joins!

var dataset = [ 5, 10, 20, 15, 18 ];

d3.select(“svg”).selectAll(“circle”)
  .data(dataset)
  .enter()
  .append(“circle”);
// Data joins!

var dataset = [ 5, 10, 20, 15, 18 ];

d3.select(“svg”).selectAll(“circle”)
  .data(dataset)
  .enter()
  .append(“circle”);




                  ?
           (empty selection)
// Data joins!

var dataset = [ 5, 10, 20, 15, 18 ];

d3.select(“svg”).selectAll(“circle”)
  .data(dataset)
  .enter()
  .append(“circle”);


     5 values       0 circles


     5 10                           Room for
    15 18
      20
                -               =    5 new
                                    circles!
// Data joins!

var dataset = [ 5 10, 20 15 18 ];
                5, 10 20, 15,

d3.select(“svg”).selectAll(“circle”)
  .data(dataset)
  .enter()
  .append(“circle”);
// Data joins!

var dataset = [ 5, 10, 20, 15, 18 ];

d3.select(“svg”).selectAll(“circle”)
  .data(dataset)
  .enter()
  .append(“circle”);




    5      10      20     15      18
5   10   20   15   18
// Setting attributes from data!




    5      10      20     15       18
d3.selectAll(“circle”)
  .attr(“r”, function(d) {
      return d;
  });



    5      10      20        15   18
// Binding data to elements

// 1. Lets you reference values later
// 2. Prevents need to “redraw” elements



    5      10      20     15      18
What else can D3 do for me?
// Scale values

var scale = d3.scale.linear()
                    .domain([200, 1000])
                    .range([0, 500]);

scale(600);   // Returns 250

                      600
200                                  1000



                      250
 0                                   500
// Generate axes

var axis = d3.svg.axis()
                 .scale(scale);

svg.append("g")
   .call(axis);



200   300   400   500   600   700   800   900   1000
// Transitions and motion
// Interactivity

                   Tooltipz
                   roxxx!
// Layouts
// Geomapping and projections
One step at a time
An Introduction to Designing With D3




@alignedleft                                                           Thanks!
  alignedleft.com
                    Interactive Data                                   Questions?
                    Visualization
                                                   for the Web




                                                        Scott Murray

More Related Content

PDF
Intro to D3: Data-Driven Documents
PDF
D3 js
PDF
Introduction to data visualisations with d3.js — Data Driven Documents
PDF
Introduction to data visualisation with D3
PDF
D3.js: Data Visualization for the Web
PDF
D3 data visualization
PDF
A Quick and Dirty D3.js Tutorial
PPTX
Intro to D3: Data-Driven Documents
D3 js
Introduction to data visualisations with d3.js — Data Driven Documents
Introduction to data visualisation with D3
D3.js: Data Visualization for the Web
D3 data visualization
A Quick and Dirty D3.js Tutorial

What's hot (12)

PPTX
SVCC 2013 D3.js Presentation (10/05/2013)
PDF
Learn D3.js in 90 minutes
PPTX
Introduction to D3.js
PDF
D3 Basic Tutorial
PPTX
SVG, CSS3, and D3 for Beginners
PDF
Create Graph and Grid Using D3 Library
PDF
Biological Modeling, Powered by AngularJS
PPTX
PDF
HTML5 after the hype - JFokus2015
PDF
Html5 em 30 minutos
PDF
Declarative web data visualization using ClojureScript
PPTX
CT presentatie JQuery 7.12.11
SVCC 2013 D3.js Presentation (10/05/2013)
Learn D3.js in 90 minutes
Introduction to D3.js
D3 Basic Tutorial
SVG, CSS3, and D3 for Beginners
Create Graph and Grid Using D3 Library
Biological Modeling, Powered by AngularJS
HTML5 after the hype - JFokus2015
Html5 em 30 minutos
Declarative web data visualization using ClojureScript
CT presentatie JQuery 7.12.11
Ad

Viewers also liked (20)

PPTX
Visualizing data with d3
PDF
Marzzippan february 21 2013
PDF
Linzer slides-barug
PDF
Climatecorp2
PDF
Dan node meetup_socket_talk
PDF
Times Ten in-memory database when time counts - Laszlo Ludas
PDF
The Craftsman Developer In An Agile World
PDF
D3.js mindblow
PPTX
ASP.NET Core: The best of the new bits
PPTX
Python for Big Data Analytics
PPTX
.Net Core
PPTX
ASP.NET Core 1.0 Overview
PDF
The Myth Of Requirements
PPTX
Python in the Hadoop Ecosystem (Rock Health presentation)
PDF
Translating Big Raw Data Into Small Actionable Information
PDF
Real Time Data Strategy and Architecture
PDF
Process Oriented Architecture
PDF
Introduction To Business Architecture – Part 1
PPT
Solution Architecture Concept Workshop
PDF
Complexity and Solution Architecture
Visualizing data with d3
Marzzippan february 21 2013
Linzer slides-barug
Climatecorp2
Dan node meetup_socket_talk
Times Ten in-memory database when time counts - Laszlo Ludas
The Craftsman Developer In An Agile World
D3.js mindblow
ASP.NET Core: The best of the new bits
Python for Big Data Analytics
.Net Core
ASP.NET Core 1.0 Overview
The Myth Of Requirements
Python in the Hadoop Ecosystem (Rock Health presentation)
Translating Big Raw Data Into Small Actionable Information
Real Time Data Strategy and Architecture
Process Oriented Architecture
Introduction To Business Architecture – Part 1
Solution Architecture Concept Workshop
Complexity and Solution Architecture
Ad

Similar to Learning d3 (20)

PPTX
Svcc 2013-d3
PPTX
SVGD3Angular2React
PDF
Utahjs D3
PDF
Visualization of Big Data in Web Apps
PDF
D3: Easy and flexible data visualisation using web standards
PDF
Visual Exploration of Large Data sets with D3, crossfilter and dc.js
PDF
資料視覺化 - D3 的第一堂課 | WeiYuan
PPTX
Pittsburgh code and supply
PDF
d3jsではじめるデータビジュアライゼーション入門
PDF
GraphX: Graph Analytics in Apache Spark (AMPCamp 5, 2014-11-20)
PDF
Spark streaming , Spark SQL
PDF
Introduction to D3
PDF
Best Practices for Building and Deploying Data Pipelines in Apache Spark
PPTX
Machine Learning with Microsoft Azure
PPTX
D3js learning tips
PDF
OrientDB - The 2nd generation of (multi-model) NoSQL
PPTX
IndyCodeCamp SDS May 16th 2009
PDF
Get Back in Control of Your SQL with jOOQ at #Java2Days
PDF
Get Back in Control of your SQL
PDF
CSS3: Are you experienced?
Svcc 2013-d3
SVGD3Angular2React
Utahjs D3
Visualization of Big Data in Web Apps
D3: Easy and flexible data visualisation using web standards
Visual Exploration of Large Data sets with D3, crossfilter and dc.js
資料視覺化 - D3 的第一堂課 | WeiYuan
Pittsburgh code and supply
d3jsではじめるデータビジュアライゼーション入門
GraphX: Graph Analytics in Apache Spark (AMPCamp 5, 2014-11-20)
Spark streaming , Spark SQL
Introduction to D3
Best Practices for Building and Deploying Data Pipelines in Apache Spark
Machine Learning with Microsoft Azure
D3js learning tips
OrientDB - The 2nd generation of (multi-model) NoSQL
IndyCodeCamp SDS May 16th 2009
Get Back in Control of Your SQL with jOOQ at #Java2Days
Get Back in Control of your SQL
CSS3: Are you experienced?

Learning d3

  • 1. 6 10 45 20 Learning D3 What is d3.js all about? And how do I get started?
  • 2. 20 Scott Murray Assistant Professor, Design University of San Francisco 45 10 6
  • 6. <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <title>D3 Page Template</title> <script type="text/javascript" src="d3.v3.js"></script> </head> <body> <script type="text/javascript"> // Your beautiful D3 code // can go here </script> </body> </html>
  • 7. HTML Hypertext Markup Language CSS Cascading Style Sheets JS JavaScript SVG Scalable Vector Graphics DOM The Document Object Model all of the above == web standards
  • 8. HTML Hypertext Markup Language CSS Cascading Style Sheets JS JavaScript SVG Scalable Vector Graphics DOM The Document Object Model Learning D3 is a process of “learning the web”
  • 9. What does data look like on the web?
  • 10. // JavaScript arrays! var dataset = [ 5, 10, 20, 15, 18 ];
  • 11. // Data joins! var dataset = [ 5, 10, 20, 15, 18 ]; d3.select(“svg”).selectAll(“circle”) .data(dataset) .enter() .append(“circle”);
  • 12. // Data joins! var dataset = [ 5, 10, 20, 15, 18 ]; d3.select(“svg”).selectAll(“circle”) .data(dataset) .enter() .append(“circle”);
  • 13. // Data joins! var dataset = [ 5, 10, 20, 15, 18 ]; d3.select(“svg”).selectAll(“circle”) .data(dataset) .enter() .append(“circle”); ? (empty selection)
  • 14. // Data joins! var dataset = [ 5, 10, 20, 15, 18 ]; d3.select(“svg”).selectAll(“circle”) .data(dataset) .enter() .append(“circle”); 5 values 0 circles 5 10 Room for 15 18 20 - = 5 new circles!
  • 15. // Data joins! var dataset = [ 5 10, 20 15 18 ]; 5, 10 20, 15, d3.select(“svg”).selectAll(“circle”) .data(dataset) .enter() .append(“circle”);
  • 16. // Data joins! var dataset = [ 5, 10, 20, 15, 18 ]; d3.select(“svg”).selectAll(“circle”) .data(dataset) .enter() .append(“circle”); 5 10 20 15 18
  • 17. 5 10 20 15 18
  • 18. // Setting attributes from data! 5 10 20 15 18
  • 19. d3.selectAll(“circle”) .attr(“r”, function(d) { return d; }); 5 10 20 15 18
  • 20. // Binding data to elements // 1. Lets you reference values later // 2. Prevents need to “redraw” elements 5 10 20 15 18
  • 21. What else can D3 do for me?
  • 22. // Scale values var scale = d3.scale.linear() .domain([200, 1000]) .range([0, 500]); scale(600); // Returns 250 600 200 1000 250 0 500
  • 23. // Generate axes var axis = d3.svg.axis() .scale(scale); svg.append("g") .call(axis); 200 300 400 500 600 700 800 900 1000
  • 25. // Interactivity Tooltipz roxxx!
  • 27. // Geomapping and projections
  • 28. One step at a time
  • 29. An Introduction to Designing With D3 @alignedleft Thanks! alignedleft.com Interactive Data Questions? Visualization for the Web Scott Murray