Understanding the “d” and “i" in D3 Functions
  Duration: 6:15
Part of Course: D3 V4 Tutorial
This Lesson is for subscribers

Understanding_the_d_and_the_i_in_d3_functions_280x158
Unlock this lesson NOW!
  • Get expert advice on Understanding the “d” and “i" in D3 Functions
  • Enjoy access to the complete DashingD3js catalog
  • Start mastering D3.js right now!

Takeaways:

  • D3 operators allow you to access the data bound to DOM elements and their selection index number
  • In most examples the "d" designates the bound data
  • In most examples the "i" designates the index number of the element in the selection
  • Though the examples are all uniform in their use of "d" and "i", D3 doesn't care nor know what "d" and "i" actually stand for as they only use the names you pass into the anonymous or named functions in the D3 operator
  • The "d" and "i" are symbols that are assigned values based on their positional arrangement in the function call.
  • In using D3 operators, function (d, i) { return d; } is not the same as function (i, d) { return d; }
  • In using D3 operators, function (d, i) { return i; } is not the same as function (i, d) { return i; }

Resources:

This Transcript is for subscribers.

Understanding_the_d_and_the_i_in_d3_functions_280x158
Unlock this D3 Tutorial NOW!
  • Get expert advice on Understanding the “d” and “i" in D3 Functions
  • Enjoy access to the complete DashingD3js catalog
  • Start mastering D3.js right now!
<< Back To D3 Screencast and Written Tutorials Index