Welcome to D3.js 4.x Data Visualization, Third Edition. Over the course of this book, you’ll learn the basics of one of the world’s most ubiquitous and powerful data visualization libraries, but we don’t stop there. By the end of our time together, you’ll have all the skills you need to become a total D3 ninja, and will be able to do everything from build visualizations from scratch straight through to using it on the server and writing automated tests. If you haven’t leveled up your JavaScript skills in a while, you’re in for a treat--this book endeavors to use the latest features currently being added to the language, all the while explaining why they’re cool and how they differ from "old school" JavaScript.
Chapter 1, Getting Started with D3, ES2017, and Node.js, covers the latest tools for building data visualizations using D3.
Chapter 2, A Primer on DOM, SVG, and CSS, reviews the underlying web technologies that D3 can manipulate.
Chapter 3, Shape Primitives of D3, identifies and creates the basic shapes that comprise a data visualization.
Chapter 4, Making Data Useful, teaches how to transform data so that D3 can visualize it.
Chapter 5, Defining the User Experience – Animation and Interaction, helps you use animation and user interactivity to drive your data visualizations.
Chapter 6, Hierarchical Layouts of D3, focuses on how hierarchical layouts can take your D3 skills to the next level by providing reusable patterns for creating complex charts.
Chapter 7, The Other Layouts, discusses the non-hierarchical layouts that speed the creation of many addition complex chart types.
Chapter 8, D3 on the Server with Canvas, Koa 2, and Node.js, outlines how to build and deploy a Node.js-based web service that renders D3 using Koa.js and Canvas.
Chapter 9, Having Confidence in Your Visualizations, showcases how to improve the quality of your code by introducing linting, static type checking, and automated testing to your projects.
Chapter 10, Designing Good Data Visualizations, compares and contrasts differing approaches to data visualization while building a set of best practices.
You will need a machine that is capable of running Node.js. We will discuss how to install this in the first chapter--you can run it on pretty much anything, but having a few extra gigabytes of RAM available will probably help you while developing. Some of the mapping examples later in the book are kind of CPU intensive, though most machines produced since 2014 should be able to handle it.
You should also have the latest version of your favorite web browser--mine is Chrome, and I use it in the examples, but Firefox also works well. You can also try to work in Safari or Internet Explorer/Edge, or Opera, or any number of other browsers, but I find Chrome’s developer tools to be the best.
This book is for web developers, interactive news developers, data scientists, and anyone interested in representing data through interactive visualizations on the Web with D3. Some basic knowledge of JavaScript is expected, but no prior experience with data visualization or D3 is required to follow this book.
In this book, you will find a number of text styles that distinguish between different kinds of information. Here are some examples of these styles and an explanation of their meaning.
Code words in text, database table names, folder names, filenames, file extensions, pathnames, dummy URLs, user input, and Twitter handles are shown as follows: "If it says something similar to Command not found
, double-check whether you've installed everything correctly, and verify that Node.js is in your $PATH
environment variable."
A block of code is set as follows:
"babel": { "presets": [ "es2017" ] }, "main": "lib/main.js", "scripts": { "start": "webpack-dev-server --inline", },
Any command-line input or output is written as follows:
$ brew install n $ n lts
New terms and important words are shown in bold. Words that you see on the screen, for example, in menus or dialog boxes, appear in the text like this: "We will mostly use the Elements
and Console
tabs, Elements
to inspect the DOM and Console
to play with JavaScript code and look for any problems."
Feedback from our readers is always welcome. Let us know what you think about this book-what you liked or disliked. Reader feedback is important for us as it helps us develop titles that you will really get the most out of. To send us general feedback, simply e-mail [email protected]
, and mention the book's title in the subject of your message. If there is a topic that you have expertise in and you are interested in either writing or contributing to a book, see our author guide at www.packtpub.com/authors.
Now that you are the proud owner of a Packt book, we have a number of things to help you to get the most from your purchase.
You can download the example code files for this book from your account at http://www.packtpub.com. If you purchased this book elsewhere, you can visit http://www.packtpub.com/support and register to have the files e-mailed directly to you.
You can download the code files by following these steps:
- Log in or register to our website using your e-mail address and password.
- Hover the mouse pointer on the
SUPPORT
tab at the top. - Click on
Code Downloads & Errata
. - Enter the name of the book in the
Search
box. - Select the book for which you're looking to download the code files.
- Choose from the drop-down menu where you purchased this book from.
- Click on
Code Download
.
Once the file is downloaded, please make sure that you unzip or extract the folder using the latest version of:
- WinRAR / 7-Zip for Windows
- Zipeg / iZip / UnRarX for Mac
- 7-Zip / PeaZip for Linux
The code bundle for the book is also hosted on GitHub at https://github.com/PacktPublishing/D3.js-4.x-Data-Visualization. We also have other code bundles from our rich catalog of books and videos available at https://github.com/PacktPublishing/. Check them out!
Although we have taken every care to ensure the accuracy of our content, mistakes do happen. If you find a mistake in one of our books-maybe a mistake in the text or the code-we would be grateful if you could report this to us. By doing so, you can save other readers from frustration and help us improve subsequent versions of this book. If you find any errata, please report them by visiting http://www.packtpub.com/submit-errata, selecting your book, clicking on the Errata Submission Form
link, and entering the details of your errata. Once your errata are verified, your submission will be accepted and the errata will be uploaded to our website or added to any list of existing errata under the Errata section of that title.
To view the previously submitted errata, go to https://www.packtpub.com/books/content/supportand enter the name of the book in the search field. The required information will appear under the Errata
section.
Piracy of copyrighted material on the Internet is an ongoing problem across all media. At Packt, we take the protection of our copyright and licenses very seriously. If you come across any illegal copies of our works in any form on the Internet, please provide us with the location address or website name immediately so that we can pursue a remedy.
Please contact us at [email protected]
with a link to the suspected pirated material.
We appreciate your help in protecting our authors and our ability to bring you valuable content.
If you have a problem with any aspect of this book, you can contact us at [email protected]
, and we will do our best to address the problem.