SlideShare a Scribd company logo
1 of 29
Download to read offline
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?
<!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

What's hot

SVCC 2013 D3.js Presentation (10/05/2013)
SVCC 2013 D3.js Presentation (10/05/2013)SVCC 2013 D3.js Presentation (10/05/2013)
SVCC 2013 D3.js Presentation (10/05/2013)Oswald Campesato
 
Learn D3.js in 90 minutes
Learn D3.js in 90 minutesLearn D3.js in 90 minutes
Learn D3.js in 90 minutesJos Dirksen
 
D3 Basic Tutorial
D3 Basic TutorialD3 Basic Tutorial
D3 Basic TutorialTao Jiang
 
SVG, CSS3, and D3 for Beginners
SVG, CSS3, and D3 for BeginnersSVG, CSS3, and D3 for Beginners
SVG, CSS3, and D3 for BeginnersOswald Campesato
 
Create Graph and Grid Using D3 Library
Create Graph and Grid Using D3 LibraryCreate Graph and Grid Using D3 Library
Create Graph and Grid Using D3 LibraryYanliang Bao (Beryl)
 
Biological Modeling, Powered by AngularJS
Biological Modeling, Powered by AngularJSBiological Modeling, Powered by AngularJS
Biological Modeling, Powered by AngularJSGil Fink
 
HTML5 after the hype - JFokus2015
HTML5 after the hype - JFokus2015HTML5 after the hype - JFokus2015
HTML5 after the hype - JFokus2015Christian Heilmann
 
Declarative web data visualization using ClojureScript
Declarative web data visualization using ClojureScriptDeclarative web data visualization using ClojureScript
Declarative web data visualization using ClojureScriptOSCON Byrum
 
CT presentatie JQuery 7.12.11
CT presentatie JQuery 7.12.11CT presentatie JQuery 7.12.11
CT presentatie JQuery 7.12.11virtualsciences41
 

What's hot (12)

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

Viewers also liked

Visualizing data with d3
Visualizing data with d3Visualizing data with d3
Visualizing data with d3Punit Jajodia
 
Marzzippan february 21 2013
Marzzippan february 21 2013Marzzippan february 21 2013
Marzzippan february 21 2013Ishi von Meier
 
Dan node meetup_socket_talk
Dan node meetup_socket_talkDan node meetup_socket_talk
Dan node meetup_socket_talkIshi von Meier
 
Times Ten in-memory database when time counts - Laszlo Ludas
Times Ten in-memory database when time counts - Laszlo LudasTimes Ten in-memory database when time counts - Laszlo Ludas
Times Ten in-memory database when time counts - Laszlo LudasORACLE USER GROUP ESTONIA
 
The Craftsman Developer In An Agile World
The Craftsman Developer In An Agile WorldThe Craftsman Developer In An Agile World
The Craftsman Developer In An Agile WorldOpenAgile Romania
 
ASP.NET Core: The best of the new bits
ASP.NET Core: The best of the new bitsASP.NET Core: The best of the new bits
ASP.NET Core: The best of the new bitsKen Cenerelli
 
Python for Big Data Analytics
Python for Big Data AnalyticsPython for Big Data Analytics
Python for Big Data AnalyticsEdureka!
 
The Myth Of Requirements
The Myth Of RequirementsThe Myth Of Requirements
The Myth Of RequirementsAlan McSweeney
 
Python in the Hadoop Ecosystem (Rock Health presentation)
Python in the Hadoop Ecosystem (Rock Health presentation)Python in the Hadoop Ecosystem (Rock Health presentation)
Python in the Hadoop Ecosystem (Rock Health presentation)Uri Laserson
 
Translating Big Raw Data Into Small Actionable Information
Translating Big Raw Data Into Small Actionable InformationTranslating Big Raw Data Into Small Actionable Information
Translating Big Raw Data Into Small Actionable InformationAlan McSweeney
 
Real Time Data Strategy and Architecture
Real Time Data Strategy and ArchitectureReal Time Data Strategy and Architecture
Real Time Data Strategy and ArchitectureAlan McSweeney
 
Process Oriented Architecture
Process Oriented ArchitectureProcess Oriented Architecture
Process Oriented ArchitectureAlan McSweeney
 
Introduction To Business Architecture – Part 1
Introduction To Business Architecture – Part 1Introduction To Business Architecture – Part 1
Introduction To Business Architecture – Part 1Alan McSweeney
 
Solution Architecture Concept Workshop
Solution Architecture Concept WorkshopSolution Architecture Concept Workshop
Solution Architecture Concept WorkshopAlan McSweeney
 
Complexity and Solution Architecture
Complexity and Solution ArchitectureComplexity and Solution Architecture
Complexity and Solution ArchitectureAlan McSweeney
 

Viewers also liked (20)

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

Similar to Learning d3

Visualization of Big Data in Web Apps
Visualization of Big Data in Web AppsVisualization of Big Data in Web Apps
Visualization of Big Data in Web AppsEPAM
 
D3: Easy and flexible data visualisation using web standards
D3: Easy and flexible data visualisation using web standardsD3: Easy and flexible data visualisation using web standards
D3: Easy and flexible data visualisation using web standardsJos Dirksen
 
Visual Exploration of Large Data sets with D3, crossfilter and dc.js
Visual Exploration of Large Data sets with D3, crossfilter and dc.jsVisual Exploration of Large Data sets with D3, crossfilter and dc.js
Visual Exploration of Large Data sets with D3, crossfilter and dc.jsFlorian Georg
 
資料視覺化 - D3 的第一堂課 | WeiYuan
資料視覺化 - D3 的第一堂課 | WeiYuan資料視覺化 - D3 的第一堂課 | WeiYuan
資料視覺化 - D3 的第一堂課 | WeiYuanWei-Yuan Chang
 
Pittsburgh code and supply
Pittsburgh code and supplyPittsburgh code and supply
Pittsburgh code and supplydudaspm
 
d3jsではじめるデータビジュアライゼーション入門
d3jsではじめるデータビジュアライゼーション入門d3jsではじめるデータビジュアライゼーション入門
d3jsではじめるデータビジュアライゼーション入門Kohei Kadowaki
 
GraphX: Graph Analytics in Apache Spark (AMPCamp 5, 2014-11-20)
GraphX: Graph Analytics in Apache Spark (AMPCamp 5, 2014-11-20)GraphX: Graph Analytics in Apache Spark (AMPCamp 5, 2014-11-20)
GraphX: Graph Analytics in Apache Spark (AMPCamp 5, 2014-11-20)Ankur Dave
 
Spark streaming , Spark SQL
Spark streaming , Spark SQLSpark streaming , Spark SQL
Spark streaming , Spark SQLYousun Jeong
 
Best Practices for Building and Deploying Data Pipelines in Apache Spark
Best Practices for Building and Deploying Data Pipelines in Apache SparkBest Practices for Building and Deploying Data Pipelines in Apache Spark
Best Practices for Building and Deploying Data Pipelines in Apache SparkDatabricks
 
Machine Learning with Microsoft Azure
Machine Learning with Microsoft AzureMachine Learning with Microsoft Azure
Machine Learning with Microsoft AzureDmitry Petukhov
 
D3js learning tips
D3js learning tipsD3js learning tips
D3js learning tipsLearningTech
 
OrientDB - The 2nd generation of (multi-model) NoSQL
OrientDB - The 2nd generation of  (multi-model) NoSQLOrientDB - The 2nd generation of  (multi-model) NoSQL
OrientDB - The 2nd generation of (multi-model) NoSQLRoberto Franchini
 
IndyCodeCamp SDS May 16th 2009
IndyCodeCamp SDS May 16th 2009IndyCodeCamp SDS May 16th 2009
IndyCodeCamp SDS May 16th 2009Aaron King
 
Get Back in Control of Your SQL with jOOQ at #Java2Days
Get Back in Control of Your SQL with jOOQ at #Java2DaysGet Back in Control of Your SQL with jOOQ at #Java2Days
Get Back in Control of Your SQL with jOOQ at #Java2DaysLukas Eder
 
CSS3: Are you experienced?
CSS3: Are you experienced?CSS3: Are you experienced?
CSS3: Are you experienced?Denise Jacobs
 

Similar to Learning d3 (20)

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