If you’re in a hurry to learn D3.js, the leading JavaScript library for web-based graphics and visualization, this book is for you. Written for technically savvy readers with a background in programming or data science, the book moves quickly, emphasizing unifying concepts and patterns. Anticipating common difficulties, author Philipp K. Janert teaches you how to apply D3 to your own problems.
Assuming only a general programming background, but no previous experience with contemporary web development, this book explains supporting technologies such as SVG, HTML5, CSS, and the DOM as needed, making it a convenient one-stop resource for a technical audience.
• Understand D3 selections, the library’s fundamental organizing principle
• Learn how to create data-driven documents with data binding
• Create animated graphs and interactive user interfaces
• Draw figures with curves, shapes, and colors
• Use the built-in facilities for heatmaps, tree graphs, and networks
• Simplify your work by writing your own reusable components
Author(s): Philipp K. Janert
Edition: 1
Publisher: O'Reilly Media
Year: 2019
Language: English
Commentary: True PDF
Pages: 256
City: Sebastopol, CA
Tags: Data Science Data Visualization Statistics D3.js
Cover
Copyright
Table of Contents
Preface
Conventions Used in This Book
Using Code Examples
O’Reilly Online Learning
How to Contact Us
Acknowledgments
Chapter 1. Introduction
Whom This Book Is For
Why D3?
What Is in This Book
… and What Is Not
How to Read This Book
Conventions
Conventions of the D3 API
Conventions for the API Reference Tables
Conventions for the Code Examples
Chapter 2. Let’s Make Some Graphs, Already!
A First Example: A Single Data Set
A Second Example: Two Data Sets
Plotting Symbols and Lines
Adding Graph Elements with Reusable Components
A Third Example: Animating List Items
Creating HTML Elements with D3
Creating a Simple Animation
Chapter 3. The Heart of the Matter: Selecting and Binding
Selections
Creating Selections
Understanding Selections
Binding Data
Unmatched Items: The Enter and Exit Selections
Joining on a Key
The General Update Pattern
Manipulating Selections
Operating on Elements of a Selection
Operating on Selections Themselves
Shared Parent Information Among Selections with Groups
Chapter 4. Events, Interactivity, and Animation
Events
Exploring Graphs with the Mouse
Case Study: Simultaneous Highlighting
The D3 Drag-and-Drop Behavior Component
Notes on User Interface Programming
Smooth Transitions
Creating and Configuring Transitions
Using Transitions
Hints and Techniques
Animation with Timer Events
Example: Real-Time Animations
Example: Smoothing Periodic Updates with Transitions
Chapter 5. Generators, Components, Layouts: Drawing Curves and Shapes
Generators, Components, and Layouts
Symbols
Using D3 Built-Ins
Custom Symbols
SVG Fragments as Symbols
Lines and Curves
Built-In Curves
Custom Curves
Circles, Arcs, and Pie Charts: Working with Layouts
Other Shapes
Writing Your Own Components
A Simple Component
Working with Components
A Component to Save Keystrokes
SVG Transformations as Components
Chapter 6. Files, Fetches, Formats: Getting Data In and Out
Fetching a File
Examples
Controlling Fetches with the RequestInit Object
Parsing and Writing Tabular Data
Field Value Conversions
Parsing Input Containing Arbitrary Delimiters
Generating Tabular Output
Using Regular Expressions to Parse Whitespace-Separated Data
Formatting Numbers
Locales
Formatters
Format or Conversion Specifiers
Chapter 7. Values to Visuals: Interpolations, Scales, and Axes
Interpolation
How Universal Interpolation Works
Implementation Notes and Custom Interpolators
Scales
Continuous Scales: Numbers to Numbers
Binning Scales: Numbers to Bins
Discrete or Ordinal Scales: Keys to Sequence
Axes
The Constituents of an Axis
Creating an Axis and Moving It into Position
Customizing Tick Marks and Their Labels
Examples
Falling Long-Distance Costs: Linear and Logarithmic Scales
Server Load: Time Series and Discrete Colors
Chapter 8. Colors, Color Scales, and Heatmaps
Colors and Color Space Conversions
Color Schemes
Cartographic Schemes
False-Color Schemes
Other Color Schemes
Color Scales
Discrete Colors
Color Gradients
Making a Color Box
False-Color Graphs and Related Techniques
Heatmaps
Contour Lines
Chapter 9. Trees and Networks
Trees and Hierarchical Data Structures
Preparing the Data
Link and Node Diagrams for Trees
Area Graphs for Containment Hierarchies
Force-Based Particle Arrangements
Simulation How-To
Built-In Interactions
Examples
Chapter 10. Utilities: Arrays, Statistics, and Timestamps
Structural Array Manipulations
Descriptive Statistics for Numerical Arrays
Histograms
Working with Dates and Timestamps
Parsing and Formatting Timestamps
Appendix A. Setup, Tools, Resources
Setup
Tools
Resources
Books
Websites, Example Collections, and Galleries
Appendix B. An SVG Survival Kit
Introduction
General Overview
Shapes
Path
Text
Presentational Attributes
Color
Transformations
Structural Elements and Document Organization
Coordinates, Scaling, and Rendering
SVG and CSS
Resources
Appendix C. Hitchhiker’s Guide to JavaScript and the DOM
JavaScript
The DOM
Classes
DOM Events
Event Propagation
The Browser as Development Environment
Resources
JavaScript
Index
About the Author
Colophon