Intro to D3.js

Chris Uehlinger

What is D3?

  • Data Driven Documents
  • Built by Mike Bostock
  • It can draw using:
    • HTML elements (<div>'s, <span>'s, <ul>'s, <li>'s)
    • SVG elements (<g>'s, <circle>'s, <rect>'s, <text>'s)
    • Canvas (using the browser's Canvas API)

Topics

  • How to Learn D3
  • Bar Chart Tutorial:
    • Selectors
    • Data Joins
    • Scales
    • Transitions

Let's make a bar chart

1 2 3

Data


var data = [
	4, 
	8, 
	15, 
	16, 
	23, 
	42
];
                        

D3 Code


d3.select(".chart")
  .selectAll("div")
    .data(data)
  .enter().append("div")
    .text(function(d) { return d; });
                        

Markup


D3 Resources

Thanks for watching!

@Uehreka