D3 Start to Finish (2nd Edition)
D3 Start to Finish (2nd Edition)
Learn how to make a custom data visualisation using D3.js.
About the Book
D3 Start to Finish (2nd edition) teaches you how to build a custom, interactive and beautiful data visualisation using the JavaScript library D3.js (versions 6 and 7).
The book covers D3 concepts such as selections, joins, requests, scale functions, event handling and transitions. It also covers general web development techniques such as state management and modularisation. In other words, everything you need to know to build a real world, custom data visualisation.
You'll also learn how these concepts are put into practice by seeing how an interactive data visualisation called Energy Explorer is built. This is a custom data visualisation that visualises the energy mix of 141 countries. There are 15 separate build steps and you're taken through each step in detail. There's also a code download link for all 15 steps.
The 2nd edition supports ES modules. It's generally revised and updated from the original edition. It also includes appendices on data transformation and adding responsivity and dark mode to Energy Explorer.
Some of the topics covered are:
- requesting CSV data using D3
- D3 data joins (including joining nested data)
- architecting a data visualisation using a layout function
- detailed styling using CSS
- adding a tooltip using the Tippy.js library
- state management
- animations using D3 transitions
- data manipulation using Lodash
- adding a menu, legend and footer
- ES modules
- how to transform the raw data from the World Bank into the required format
- how to make Energy Explorer responsive to different device widths
- how to add a dark mode to Energy Explorer
To get the most out of this book you need to be familiar with HTML, SVG, CSS and JavaScript. If you need to get up to speed with these languages I recommend my book Fundamentals of HTML, CSS, SVG & JavaScript for Data Visualisation. I've bundled both books together at a reduced cost (visit bundle).
You also need a text editor (such as VS Code), a web browser and Node.js installed on your computer. The book contains appendices that help you get these set up.
Team Discounts
Get a team discount on this book!
Bundles that include this book
Table of Contents
- 1. Introduction
- 2. Energy Explorer
- 3. Getting started
- 4. Introduction to D3
- 5. Requesting Data with D3
- 6. Build: Load the Data
- 7. D3 Selections
- 8. Data Joins
- 9. Build: Draw the Data
- 10. Scale Functions
- 11. Build: Size the Circles
- 12. Architecture for Web-based Data Visualisation
- 13. Build: Add Modules and layout function
- 14. Arranging Items in a Grid
- 15. Build: Arrange the Data
- 16. The Build So Far
- 17. More on D3 Selections
- 18. More on D3 Joins
- 19. Build: Add Labels
- 20. Build: Add More Circles
- 21. Build: Style the Circles
- 22. D3 Event Handling
- 23. Tippy.js Tooltip Library
- 24. Build: Add a tooltip
- 25. State Management
- 26. Build: Add a Menu
- 27. Data Manipulation
- 28. Build: Sort the Countries
- 29. D3 Transitions
- 30. Build: Add Transitions
- 31. Build: Add a Legend
- 32. Build: Finishing Touches
- 33. Wrapping Up
- Appendix A: Tools and Set-up
- Appendix B: Deploying Energy Explorer
- Appendix C: ES2015 Modules
- Appendix D: Data transformation
- Appendix E: Responsiveness
- Appendix F: Dark Mode
The Leanpub 60 Day 100% Happiness Guarantee
Within 60 days of purchase you can get a 100% refund on any Leanpub purchase, in two clicks.
Now, this is technically risky for us, since you'll have the book or course files either way. But we're so confident in our products and services, and in our authors and readers, that we're happy to offer a full money back guarantee for everything we sell.
You can only find out how good something is by trying it, and because of our 100% money back guarantee there's literally no risk to do so!
So, there's no reason not to click the Add to Cart button, is there?
See full terms...
Earn $8 on a $10 Purchase, and $16 on a $20 Purchase
We pay 80% royalties on purchases of $7.99 or more, and 80% royalties minus a 50 cent flat fee on purchases between $0.99 and $7.98. You earn $8 on a $10 sale, and $16 on a $20 sale. So, if we sell 5000 non-refunded copies of your book for $20, you'll earn $80,000.
(Yes, some authors have already earned much more than that on Leanpub.)
In fact, authors have earnedover $14 millionwriting, publishing and selling on Leanpub.
Learn more about writing on Leanpub
Free Updates. DRM Free.
If you buy a Leanpub book, you get free updates for as long as the author updates the book! Many authors use Leanpub to publish their books in-progress, while they are writing them. All readers get free updates, regardless of when they bought the book or how much they paid (including free).
Most Leanpub books are available in PDF (for computers) and EPUB (for phones, tablets and Kindle). The formats that a book includes are shown at the top right corner of this page.
Finally, Leanpub books don't have any DRM copy-protection nonsense, so you can easily read them on any supported device.
Learn more about Leanpub's ebook formats and where to read them