Interactive Data Visualization for the Web, 2nd Edition

Book description

Create and publish your own interactive data visualization projects on the webâ??even if you have little or no experience with data visualization or web development. Itâ??s inspiring and fun with this friendly, accessible, and practical hands-on introduction. This fully updated and expanded second edition takes you through the fundamental concepts and methods of D3, the most powerful JavaScript library for expressing data visually in a web browser.

Ideal for designers with no coding experience, reporters exploring data journalism, and anyone who wants to visualize and share data, this step-by-step guide will also help you expand your web programming skills by teaching you the basics of HTML, CSS, JavaScript, and SVG.

  • Learn D3 4.xâ??the latest D3 versionâ??with downloadable code and over 140 examples
  • Create bar charts, scatter plots, pie charts, stacked bar charts, and force-directed graphs
  • Use smooth, animated transitions to show changes in your data
  • Introduce interactivity to help users explore your data
  • Create custom geographic maps with panning, zooming, labels, and tooltips
  • Walk through the creation of a complete visualization project, from start to finish
  • Explore inspiring case studies with nine accomplished designers talking about their D3-based projects

Publisher resources

View/Submit Errata

Table of contents

  1. Preface
    1. What’s New in the Second Edition
    2. Conventions Used in This Book
    3. O’Reilly Safari
    4. How to Contact Us
    5. Acknowledgments
  2. 1. Introduction
    1. Why Data Visualization?
    2. Why Write Code?
    3. Why Interactive?
    4. Why on the Web?
    5. What This Book Is
    6. Who You Are
    7. What This Book Is Not
    8. Using Sample Code
    9. Thank You
  3. 2. Introducing D3
    1. What It Does
    2. What It Doesn’t Do
    3. Origins and Context
    4. Alternatives
      1. Easy Charts
      2. Graph Visualizations
      3. Geomapping
      4. Almost from Scratch
      5. Three-Dimensional
      6. Tools Built with D3
  4. 3. Technology Fundamentals
    1. The Web
    2. HTML
      1. Content Plus Structure
      2. Adding Structure with Elements
      3. Common Elements
      4. Attributes
      5. Classes and IDs
      6. Comments
    3. DOM
    4. Developer Tools
    5. Rendering and the Box Model
    6. CSS
      1. Selectors
      2. Properties and Values
      3. Comments
      4. Referencing Styles
      5. Inheritance, Cascading, and Specificity
    7. JavaScript
      1. Hello, Console
      2. Variables
      3. Other Variable Types
      4. Arrays
      5. Objects
      6. Objects and Arrays
      7. Mathematical Operators
      8. Comparison Operators
      9. Logical Operators
      10. Control Structures
      11. Functions
      12. Comments
      13. Referencing Scripts
      14. JavaScript Gotchas
    8. SVG
      1. The SVG Element
      2. Simple Shapes
      3. Styling SVG Elements
      4. Layering and Drawing Order
      5. Transparency
    9. A Note on Compatibility
  5. 4. Setup
    1. Downloading D3
    2. Referencing D3
    3. Setting Up a Web Server
      1. Terminal with Python
      2. MAMP, WAMP, and LAMP
      3. Diving In
  6. 5. Data
    1. Generating Page Elements
      1. Chaining Methods
      2. One Link at a Time
      3. The Handoff
      4. Going Chainless
    2. Binding Data
      1. In a Bind
      2. Data
      3. Please Make Your Selection
      4. Bound and Determined
      5. Using Your Data
      6. High-Functioning
      7. Data Wants to Be Held
      8. Beyond Text
  7. 6. Drawing with Data
    1. Drawing divs
      1. Setting Attributes
      2. A Note on Classes
      3. Back to the Bars
      4. Setting Styles
    2. The Power of data()
      1. Random Data
    3. Drawing SVGs
      1. Create the SVG
      2. Data-Driven Shapes
      3. Pretty Colors, Oooh!
    4. Making a Bar Chart
      1. The Old Chart
      2. The New Chart
      3. Color
      4. Labels
    5. Making a Scatterplot
      1. The Data
      2. The Scatterplot
      3. Size
      4. Labels
    6. Next Steps
  8. 7. Scales
    1. Apples and Pixels
    2. Domains and Ranges
    3. Normalization
    4. Creating a Scale
    5. Scaling the Scatterplot
      1. d3.min() and d3.max()
      2. Setting Up Dynamic Scales
      3. Incorporating Scaled Values
    6. Refining the Plot
    7. Other Methods
    8. Other Scales
      1. Square Root Scales
      2. Time Scales
  9. 8. Axes
    1. Introducing Axes
    2. Setting Up an Axis
    3. Positioning Axes
    4. Check for Ticks
    5. Y Not?
    6. Final Touches
    7. Formatting Tick Labels
    8. Time-Based Axes
  10. 9. Updates, Transitions, and Motion
    1. Modernizing the Bar Chart
      1. Ordinal Scales, Explained
      2. Starting Your Own Band
      3. Referencing the Band Scale
      4. Other Updates
    2. Updating Data
      1. Interaction via Event Listeners
      2. Changing the Data
      3. Updating the Visuals
    3. Transitions
      1. duration(), or How Long Is This Going to Take?
      2. ease()-y Does It
      3. Please Do Not delay()
      4. Randomizing the Data
      5. Updating Scales
      6. Updating Axes
      7. on() Transition Starts and Ends
    4. Other Kinds of Data Updates
      1. Adding Values (and Elements)
      2. Removing Values (and Elements)
      3. Data Joins with Keys
      4. Add and Remove: Combo Platter
      5. Recap
  11. 10. Interactivity
    1. Binding Event Listeners
    2. Introducing Behaviors
      1. Hover to Highlight
    3. Grouping SVG Elements
      1. Click to Sort
    4. Tooltips
      1. Default Browser Tooltips
      2. SVG Element Tooltips
      3. HTML div Tooltips
    5. Consideration for Touch Devices
    6. Moving Forward
  12. 11. Using Paths
    1. Line Charts
      1. Data Preparation
      2. Scale Setup
      3. Line ’em Up
      4. Dealing with Missing Data
      5. Refining the Visuals
    2. Area Charts
  13. 12. Selections
    1. A Closer Look at Selections
    2. Getting More Specific
    3. Storing Selections
    4. Enter, Merge, and Exit
      1. The Enter Selection
      2. Merging Selections
      3. The Exit Selection
    5. Filtering Selections Based on Data
      1. To each() Their Own
  14. 13. Layouts
    1. Pie Layout
    2. Stack Layout
      1. A New Order
      2. Anchoring Those Bars
      3. Stacked Areas
    3. Force Layout
      1. Preparing the Network Data
      2. Defining the Force Simulation
      3. Creating the Visual Elements
      4. Updating Visuals over Time
      5. Draggable Nodes
  15. 14. Geomapping
    1. JSON, Meet GeoJSON
    2. Paths
    3. Projections
    4. Choropleth
    5. Adding Points
    6. Panning
      1. Transitioning the Map
      2. Dragging the Map
      3. Border Problems
    7. Zooming
      1. Fixing the Pan Buttons
      2. Zoom-y Buttons
      3. Constraining Panning and Zooming
      4. Preset Views
    8. Value Labels
    9. Acquiring and Preparing Raw Geodata
      1. Find Shapefiles
      2. Choose a Resolution
      3. Simplify the Shapes
      4. Convert to GeoJSON
      5. Choose a Projection
  16. 15. Exporting
    1. Bitmaps
    2. PDF
    3. SVG
  17. 16. Project Walk-Through
    1. Prepare the Data
    2. Load and Parse the Data
    3. Render the Initial View
    4. Add Interactivity
    5. Refine Styling
    6. Provide Context
    7. Dancing Versus Gardening
  18. A. Case Studies
    1. “Close Votes”
    2. “What Size Am I?”
    3. “Explained Visually” Series
    4. “Workers’ Comp Benefits: How Much Is a Limb Worth?”
    5. “Farmers’ Markets” Series
    6. “Weather Circles”
    7. “Data Sketches” Series
  19. B. What’s New in 4.0
    1. Modularity
    2. Namespace and camelCase
    3. Selections
    4. Multivalue Maps
    5. Transitions
    6. Ordinal Scales
    7. Axes
    8. Stack Layout
    9. Zooming
  20. C. Further Study
    1. Interacting with Other Humans
    2. Reading Books
      1. D3 Books
      2. Other Data Visualization Books
    3. Surfing Websites
      1. D3-Related
      2. Getting a Job and Geeking Out
  21. D. Sharing Your Code
    1. bl.ocks.org
      1. Making a Block
      2. Gist-to-Blocks Browser Extensions
    2. Bl.ock Builder
    3. Making a Block with Gistup
    4. Codepen, JS Bin, or Otherwise
    5. A Normal Web Server
  22. E. Quick Reference
    1. Selections
    2. Data
    3. Transitions
    4. Scales
    5. Axes
    6. Interactivity
    7. Numbers, Dates, and Times
    8. Other Useful JavaScript
  23. Index

Product information

  • Title: Interactive Data Visualization for the Web, 2nd Edition
  • Author(s): Scott Murray
  • Release date: August 2017
  • Publisher(s): O'Reilly Media, Inc.
  • ISBN: 9781491921289