Chapter 10. Utilities: Arrays, Statistics, and Timestamps
D3 includes some ancillary features that mostly augment JavaScript’s built-in functionality. In this chapter, I’ll introduce two topics because they are so common and commonly useful: operations on arrays, including basic descriptive statistics for strictly numerical arrays, and support for working with dates and timestamps.
Structural Array Manipulations
D3 includes some functions that change the structure of arrays (of arbitrary types). Table 10-1 summarizes some of the most useful of these functions and those that are used elsewhere in this book.
| Function | Description |
|---|---|
|
Returns an array of uniformly spaced numbers, between |
|
Performs an in-place random shuffle on a subarray, bounded by array
indices |
|
Returns the Cartesian product of the arrays |
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access