
14.2.1 Debouncing and Throttling Input . . . . . . . . . . . . . . . . . . . . 201
14.2.2 Whats the Dierence? . . . . . . . . . . . . . . . . . . . . . . . . . . 201
14.2.3 Why It Matters in Visualization . . . . . . . . . . . . . . . . . . . . . 202
14.2.4 Debouncing in Practice . . . . . . . . . . . . . . . . . . . . . . . . . 202
14.2.5 Throttling in Practice . . . . . . . . . . . . . . . . . . . . . . . . . . 203
14.2.6 Real-World Use Case: Throttled Map Zoom . . . . . . . . . . . . . . 203
14.2.7 Performance Comparison . . . . . . . . . . . . . . . . . . . . . . . . 204
14.2.8 Summary ................................. 204
14.3 Lazy Loading and Virtual Rendering . . . . . . . . . . . . . . . . . . . . . . 204
14.3.1 Lazy Loading and Virtual Rendering . . . . . . . . . . . . . . . . . . 204
14.3.2 Why Lazy Load or Virtualize? . . . . . . . . . . . . . . . . . . . . . . 204
14.3.3 Real-World Example: Virtualized List of Data Points . . . . . . . . . 205
14.3.4 Option 1: Custom Virtual Scroller in Vanilla JavaScript . . . . . . . 205
14.3.5 Option 2: Using react-window for React Apps . . . . . . . . . . . . 206
14.3.6 Example with FixedSizeList: ..................... 206
14.3.7 Progressive Rendering with Charts . . . . . . . . . . . . . . . . . . . 206
14.3.8 Using IntersectionObserver for Lazy Chart Loading . . . . . . . . . . 207
14.3.9 Lazy Line/Bar Chart Rendering with D3 . . . . . . . . . . . . . . . . 207
14.3.10Summary ................................. 207
14.4 Canvas-Based Rendering for Speed . . . . . . . . . . . . . . . . . . . . . . . 208
14.4.1 Canvas-Based Rendering for Speed . . . . . . . . . . . . . . . . . . . 208
15 Exporting and Sharing 212
15.1 Exporting to PNG, SVG, or PDF . . . . . . . . . . . . . . . . . . . . . . . . 212
15.1.1 Exporting to PNG, SVG, or PDF . . . . . . . . . . . . . . . . . . . . 212
15.1.2 Exporting Canvas Charts as PNG . . . . . . . . . . . . . . . . . . . . 212
15.1.3 Exporting D3 SVG Charts as SVG or PNG . . . . . . . . . . . . . . 213
15.1.4 Exporting Charts as PDF . . . . . . . . . . . . . . . . . . . . . . . . 214
15.1.5 Summary ................................. 215
15.2 Sharing via Embeds or Static Pages . . . . . . . . . . . . . . . . . . . . . . . 215
15.2.1 Sharing via Embeds or Static Pages . . . . . . . . . . . . . . . . . . . 215
15.2.2 Embedding Charts in Blogs and Dashboards . . . . . . . . . . . . . . 215
15.2.3 Exporting Standalone HTML Pages . . . . . . . . . . . . . . . . . . 216
15.2.4 Hosting with Webpack or Vite . . . . . . . . . . . . . . . . . . . . . . 217
15.2.5 Hosting on GitHub Pages with gh-pages ................ 218
15.2.6 Summary ................................. 218
15.3 Hosting Options (GitHub Pages, Netlify) . . . . . . . . . . . . . . . . . . . . 219
15.3.1 Hosting Options (GitHub Pages, Netlify) . . . . . . . . . . . . . . . . 219
15.3.2 Static Hosting Comparison . . . . . . . . . . . . . . . . . . . . . . . 219
15.3.3 Option 1: Deploy with GitHub Pages . . . . . . . . . . . . . . . . . . 219
15.3.4
Method A: Use the
gh-pages
CLI (Recommended for Projects with
BuildSteps)................................ 219
15.3.5 Method B: Use GitHub Actions for CI/CD Deployment . . . . . . . 220
15.3.6 Option 2: Deploy with Netlify . . . . . . . . . . . . . . . . . . . . . . 221
15.3.7 Method A: Drag and Drop . . . . . . . . . . . . . . . . . . . . . . . . 221
11 readbytes.github.io