Search icon CANCEL
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Expert Data Visualization
Expert Data Visualization

Expert Data Visualization: Advanced information visualization with D3.js 4.x

Arrow left icon
Profile Icon Jos Dirksen
Arrow right icon
€22.99 €32.99
eBook Apr 2017 394 pages 1st Edition
eBook
€22.99 €32.99
Paperback
€41.99
Subscription
Free Trial
Renews at €18.99p/m
Arrow left icon
Profile Icon Jos Dirksen
Arrow right icon
€22.99 €32.99
eBook Apr 2017 394 pages 1st Edition
eBook
€22.99 €32.99
Paperback
€41.99
Subscription
Free Trial
Renews at €18.99p/m
eBook
€22.99 €32.99
Paperback
€41.99
Subscription
Free Trial
Renews at €18.99p/m

What do you get with eBook?

Product feature icon Instant access to your Digital eBook purchase
Product feature icon Download this book in EPUB and PDF formats
Product feature icon Access this title in our online reader with advanced features
Product feature icon DRM FREE - Read whenever, wherever and however you want
Table of content icon View table of contents Preview book icon Preview Book

Expert Data Visualization

Basic Charts and Shapes

In the previous chapter, we created a simple bar chart using the SVG rect element. While this works for simple charts, using the standard SVG elements for more complex charts can be difficult. Luckily, D3 provides an extensive set of helper functions that we can use to easily create more complex visualizations, without having to manipulate basic SVG elements ourselves. In this chapter, we're going to create visualizations based on data from the US Census Bureau (http://www.census.gov). To be more precise, we're going to create the following data visualizations:

  • How long have American firms been in business visualized with pies and donuts: The US census releases an overview that shows how long firms have been in business. This provides a nice data set to show how D3 allows you to create pie and donut charts.
  • Real Median Household income in the US visualized with a line chart: In...

How long have American firms been in business visualized with pies and donuts

In September 2016, the US Census Bureau released data that showed how long American firms have been in business. The US Census Bureau even created a nice-looking visualization themselves (http://www.census.gov/newsroom/press-releases/2016/cb16-148.html) showing the results from that data:

In this section, we'll create an alternative visualization using an animated donut chart. While making this, we'll explore the following subjects:

  • Learning how to use animations to occur when data is loaded
  • Using the various path generators from D3 to generate SVG paths
  • Using color interpolators to color each individual part of the donut

You can see this sample for yourself by opening example: <DVD3>/src/chapter-02/D02-01.html. The results look like this:

By selecting a different group of firm owners in the top left you can see the...

Line charts that show income growth

A line chart is a very common way of visualizing linear data (for example, time-based data). For our discussion on line charts, we're going to create a chart that shows the increase in income in the US over the last 30 years. We'll show this data indexed to a specific year and the absolute growth. We'll use the following two datasets:

  1. Unadjusted dollars: https://fred.stlouisfed.org/series/MEHOINUSA646N
  2. Adjusted dollars: https://fred.stlouisfed.org/series/MEHOINUSA672N

These datasets are based on the US Census data, but have already been cleaned up. We can use the adjusted dollars to show the relative increase in income, and the unadjusted to show the absolute growth in income:

So, while it might seem that people are getting richer, at this point we're basically at the level of 1996, and in no way back before the 2008 crisis. At the top right, you can download...

Population growth estimates using a stacked graph

For the final chart in this chapter, we're going to create a simple stacked chart, which shows the expected population growth in the US to 2060. We won't create too much interactivity or other advanced features for this graph, but will just show you how to create the following two graphs:

First, we'll create an area chart:

And then we'll use the same data to create a stacked bar chart:

In the area chart we'll show the relative population distribution over the years, and in the bar chart, we'll show the absolute population, divided into age groups.

Getting and sanitizing the data

The US Census Bureau provides a number of files related to population growth and other projections. We&apos...

Summary

In this chapter, we've looked at how you can use D3 to create basic chart types with lots of interactivity and information. While doing this, we learned a number of different D3 concepts. We've seen how we can use path generators to generate our arc segments for the donut chart and how you can add animations by using d3.transition.

In this chapter, we've also seen how easy it is with D3 to add axes to your chart, and how you can use the various scales provided by D3 to determine the size and position of your elements.

In the next chapter, we'll look at how you can visualize data that is in a hierarchical format.

Left arrow icon Right arrow icon
Download code icon Download Code

Key benefits

  • -Create complex visualizations powered by D3.js and open data.
  • -Provides an extensive set of visualizations that explore all the functionality provided by D3.js V4.
  • -Shows how to set up an easy–to-use environment to create stunning visualizations.

Description

Do you want to make sense of your data? Do you want to create interactive charts, data trees, info-graphics, geospatial charts, and maps efficiently? This book is your ideal choice to master interactive data visualization with D3.js V4. The book includes a number of extensive examples that to help you hone your skills with data visualization. Throughout nine chapters these examples will help you acquire a clear practical understanding of the various techniques, tools and functionality provided by D3.js. You will first setup your D3.JS development environment and learn the basic patterns needed to visualize your data. After that you will learn techniques to optimize different processes such as working with selections; animating data transitions; creating graps and charts, integrating external resources (static as well as streaming); visualizing information on maps; working with colors and scales; utilizing the different D3.js APIs; and much more. The book will also guide you through creating custom graphs and visualizations, and show you how to go from the raw data to beautiful visualizations. The extensive examples will include working with complex and realtime data streams, such as seismic data, geospatial data, scientific data, and more. Towards the end of the book, you will learn to add more functionality on top of D3.js by using it with other external libraries and integrating it with Ecmascript 6 and Typescript

Who is this book for?

The typical target audience of this book is JavaScript developers, designers, and visual artists who have some basic JavaScript programming knowledge and who now want to master pro-level techniques to create interactive data visualizations using web standards which work on desktop as well as mobile devices.

What you will learn

  • -Learn how D3.js works to declaratively define visualizations.
  • -Create charts from scratch by using SVG and the D3.js APIs
  • -See how to prepare data for easy visualization using D3.js.
  • -Visualize hierarchical data using chart types provided by D3.js
  • -Explore the different options provided by D3.js to visualize linked data such as graphs.
  • -Spice up your visualizations by adding interactivity and animations.
  • -Learn how to use D3.js to visualize and interact with Geo- and Gis-related information sources.
  • -Create visualization by streaming data over WebSockets

Product Details

Country selected
Publication date, Length, Edition, Language, ISBN-13
Publication date : Apr 24, 2017
Length: 394 pages
Edition : 1st
Language : English
ISBN-13 : 9781786466624
Category :
Languages :
Tools :

What do you get with eBook?

Product feature icon Instant access to your Digital eBook purchase
Product feature icon Download this book in EPUB and PDF formats
Product feature icon Access this title in our online reader with advanced features
Product feature icon DRM FREE - Read whenever, wherever and however you want

Product Details

Publication date : Apr 24, 2017
Length: 394 pages
Edition : 1st
Language : English
ISBN-13 : 9781786466624
Category :
Languages :
Tools :

Packt Subscriptions

See our plans and pricing
Modal Close icon
€18.99 billed monthly
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Simple pricing, no contract
€189.99 billed annually
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just €5 each
Feature tick icon Exclusive print discounts
€264.99 billed in 18 months
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just €5 each
Feature tick icon Exclusive print discounts

Frequently bought together


Stars icon
Total 111.97
Expert Data Visualization
€41.99
D3.js 4.x Data Visualization
€32.99
Data Visualization with D3 4.x Cookbook
€36.99
Total 111.97 Stars icon

Table of Contents

9 Chapters
Getting Started with D3 Chevron down icon Chevron up icon
Basic Charts and Shapes Chevron down icon Chevron up icon
Working with Hierarchical Data Chevron down icon Chevron up icon
Visualizing Graphs Chevron down icon Chevron up icon
Working with Geo Data Chevron down icon Chevron up icon
Visualizing Streaming Data Chevron down icon Chevron up icon
Voronoi Diagrams and Heatmaps Chevron down icon Chevron up icon
Custom Shapes and Paths and Using a Brush Selection Chevron down icon Chevron up icon
ES6, TypeScript, and External D3.js Libraries Chevron down icon Chevron up icon
Get free access to Packt library with over 7500+ books and video courses for 7 days!
Start Free Trial

FAQs

How do I buy and download an eBook? Chevron down icon Chevron up icon

Where there is an eBook version of a title available, you can buy it from the book details for that title. Add either the standalone eBook or the eBook and print book bundle to your shopping cart. Your eBook will show in your cart as a product on its own. After completing checkout and payment in the normal way, you will receive your receipt on the screen containing a link to a personalised PDF download file. This link will remain active for 30 days. You can download backup copies of the file by logging in to your account at any time.

If you already have Adobe reader installed, then clicking on the link will download and open the PDF file directly. If you don't, then save the PDF file on your machine and download the Reader to view it.

Please Note: Packt eBooks are non-returnable and non-refundable.

Packt eBook and Licensing When you buy an eBook from Packt Publishing, completing your purchase means you accept the terms of our licence agreement. Please read the full text of the agreement. In it we have tried to balance the need for the ebook to be usable for you the reader with our needs to protect the rights of us as Publishers and of our authors. In summary, the agreement says:

  • You may make copies of your eBook for your own use onto any machine
  • You may not pass copies of the eBook on to anyone else
How can I make a purchase on your website? Chevron down icon Chevron up icon

If you want to purchase a video course, eBook or Bundle (Print+eBook) please follow below steps:

  1. Register on our website using your email address and the password.
  2. Search for the title by name or ISBN using the search option.
  3. Select the title you want to purchase.
  4. Choose the format you wish to purchase the title in; if you order the Print Book, you get a free eBook copy of the same title. 
  5. Proceed with the checkout process (payment to be made using Credit Card, Debit Cart, or PayPal)
Where can I access support around an eBook? Chevron down icon Chevron up icon
  • If you experience a problem with using or installing Adobe Reader, the contact Adobe directly.
  • To view the errata for the book, see www.packtpub.com/support and view the pages for the title you have.
  • To view your account details or to download a new copy of the book go to www.packtpub.com/account
  • To contact us directly if a problem is not resolved, use www.packtpub.com/contact-us
What eBook formats do Packt support? Chevron down icon Chevron up icon

Our eBooks are currently available in a variety of formats such as PDF and ePubs. In the future, this may well change with trends and development in technology, but please note that our PDFs are not Adobe eBook Reader format, which has greater restrictions on security.

You will need to use Adobe Reader v9 or later in order to read Packt's PDF eBooks.

What are the benefits of eBooks? Chevron down icon Chevron up icon
  • You can get the information you need immediately
  • You can easily take them with you on a laptop
  • You can download them an unlimited number of times
  • You can print them out
  • They are copy-paste enabled
  • They are searchable
  • There is no password protection
  • They are lower price than print
  • They save resources and space
What is an eBook? Chevron down icon Chevron up icon

Packt eBooks are a complete electronic version of the print edition, available in PDF and ePub formats. Every piece of content down to the page numbering is the same. Because we save the costs of printing and shipping the book to you, we are able to offer eBooks at a lower cost than print editions.

When you have purchased an eBook, simply login to your account and click on the link in Your Download Area. We recommend you saving the file to your hard drive before opening it.

For optimal viewing of our eBooks, we recommend you download and install the free Adobe Reader version 9.