Git Product home page Git Product logo

d3_in_action_2's Introduction

D3.js in Action 2nd Edition code and examples.

d3.js

Everything is a self-contained example except for Chapter 9, which requires Node and NPM.

Table of Contents

Chapter 1

Chapter 2

Chapter 3

Chapter 4

Chapter 5

Chapter 6

Chapter 7

Chapter 8

Chapter 9

Chapter 10

Chapter 11

d3_in_action_2's People

Contributors

borgmajr avatar curran avatar emeeks avatar gcalmettes avatar gimyoungphil avatar kathik-ios avatar robertodeveloper avatar twgardner2 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

d3_in_action_2's Issues

Typo on page 32

The code listing above Figure 1.28 begins

smallerNumbers = someNumbers.filter(
  function(el) {return d <= 40});

The second line should say

  function(el) {return el <= 40});

Figure 1.28 shows the correct code.

Index

These are cool examples! It would be nice to have some kind of index listing, where one could click on links to each example. Perhaps adding a list of links to the README and a GitHub Pages deployment would do the trick.

colombia.png should be named Colombia.png

in the folder images all images start with a capital letter except Colombia, in the table worldcup.csv all names start with a capital letter except Colombia.

This breaks demo 3 19,20, and 21 since it is expecting Colombia and not colombia.png.

Possibly use GitHub pages?

It would be great to be able to click links in the index and be able to run the examples, without having to clone the repo and run a local server.

Problems running the examples with d3 v ^5.0

Hey :)

i really love your book and the examples. But i was now trying them out with the latest version of d3.js 5.1.0 and i ran into problems with the csv data. Its all working still fine when i use 4.2.8 or 4.13.0.

when i run e.g. the code form example 2.11 it prints out nothing, even if the CSV file was read correctly and in JavaScript itself i can access all data as expected. But its not going to be printed. I played around with it a little bit, and when i write the object myself it works.

       const myCities = [{label:"San Francisco", ...}, {label:"Fresno",....},...];
        d3.select("body").selectAll("div.cities")
          .data(myCities)
          .enter()
          .append("div")
            .attr("class","cities")
            .html(d => d.label);
`

When i wrap 
incomingData inside brackets it prints out at least the SanFrancisco but none of the others.
   d3.select("body").selectAll("div.cities")
      .data([incomingData])
      .enter()
      .append("div")
        .attr("class","cities")
        .html(d => d.label);

`

I guess this is more worth of a bug report for d3 itself or?

Also in v5 it seems like they changed the error handling in favor for using promises instead.
https://github.com/d3/d3/blob/master/CHANGES.md

For now i will just stick with Version <5.0 for working with your book, just wanted to let you know :)

Error on page 87 of second edition

The code underneath Figure 3.7 has been changed to ES6 arrow notation without consideration for what it is supposed to demonstrate.

d3.select('circle').each((d, i) => {
    console.log(d); console.log(i); console.log(this);
})

The paragraph immediately after this code listing says: "The last thing echoed to the console, this, is the <circle> DOM element itself." This may have been the case in the first edition when it was an anonymous function() declaration, but using arrow notation, this is undefined.

Either the code needs to be reverted or the text needs to be corrected.

Inconsistencies and errors in Chapter 4

The line chart of tweets in chapter 4 starts with the colour mapping, as of page 127

  • tweets = blue
  • retweets = green
  • favourites = orange

The caption of Figure 4.15 says the same, but this clearly doesn't correspond to the actual figures, which show retweets (top line) in blue, favourites (middle) in green and tweets (bottom line) in orange. This is confusing when trying to follow along with the book.


Next, there are some errors and inconsistencies on page 134. I think it's listing 4.11 but none of the listings anywhere in my book actually have labels on them—just blank grey bars above them—which I presume is also an oversight or a printing defect.

d3.select("svg")
  .append("path")
  .style("id", key + "Area")     // `id` is an attribute, not a style — a clear error
  .attr("d", movieArea(data))
  .attr("fill", "none")          // should be style, not attribute
  .attr("stroke", "#75739F")     // should be style
  .attr("stroke-width", 3)       // should be style
  .style("opacity", .75)

While attr() works for these style declarations, it's inconsistent with earlier in the book where style() has been used. And of course style('id', ...) is simply an error.

Figure 5.7 out of date syntax

On page 149,

var pieChart = d3.layout.pie();

should be as of d3 v4

var pieChart = d3.pie();

as indicated immediately above the figure in the text.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.