
- 394 pages
- English
- ePUB (mobile friendly)
- Available on iOS & Android
Expert Data Visualization
About this book
Breathe life into your data by learning how to use D3.js V4 to visualize informationAbout This Book• 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.Who This Book Is ForThe 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 WebSocketsIn DetailDo 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 TypescriptStyle and approachThis book will have a real–world, case-study approach, where you will be given data sets from different domains. These data sets will have different visualization goals; some might need 2D or 3D charts, some might need automated workflows, others might require interactive maps. While you fulfill these goals, you will learn different techniques and best practices, which will enable you to perform data visualization tasks on your own
Frequently asked questions
- Essential is ideal for learners and professionals who enjoy exploring a wide range of subjects. Access the Essential Library with 800,000+ trusted titles and best-sellers across business, personal growth, and the humanities. Includes unlimited reading time and Standard Read Aloud voice.
- Complete: Perfect for advanced learners and researchers needing full, unrestricted access. Unlock 1.4M+ books across hundreds of subjects, including academic and specialized titles. The Complete Plan also includes advanced features like Premium Read Aloud and Research Assistant.
Please note we cannot support devices running on iOS 13 and Android 7 or earlier. Learn more about using the app.
Information
Visualizing Graphs
- We'll start with the force layout. With a force layout, we can create force-directed graphs. In a force-directed graph, the nodes are connected to each other with links. All the nodes and links can exact forces on one another which will result in visually pleasing network of nodes. We will visualize this using data from the Simpsons, where we show characters' interaction with each other per episode.
- We'll make a bubble chart of the most used words of the main Simpsons characters, with the size equivalent to the number of times, and colored per person: https://bl.ocks.org/ctufts/f38ef0187f98c537d791d24fda4a6ef9.
- An alternative way to visualize a network of relations is by using a chord layout. This visualization results in a circular layout, where various parts of the circle are connected with one another to show the relation between the nodes.
- If you've got a large network you need to visualize, a force layout or a chord layout can quickly become unreadable. A static alternative is a matrix diagram. We will use this diagram to visualize the interactions between a very large number of Simpson characters.
Force layout



- We have two different kinds of node. The small circles in the previous figure represent locations, and the large circles shows the characters.
- The links between a character and a location means that that character, in the specific episode (we used the first one of season one), appeared in that location.
- When you hover over a node, it'll highlight all the outgoing connections and show the name of the location at the bottom of the screen.
- And finally, you can reposition nodes by dragging them.
Getting the raw Simpsons data
psql dbname < <DVD3>/src/chapter4/data/simpsons_db.dmp
Getting the relevant information from the database
COPY(SELECT * FROM characters) TO 'characters.csv'
WITH CSV DELIMITER ',' HEADER ;
COPY(SELECT * FROM locations) TO 'locations.csv'
WITH CSV DELIMITER ',' HEADER ;
COPY(select episode_id, character_id, location_id, raw_character_text,
raw_location_text FROM script_lines s1
WHERE s1.character_id IS NOT NULL
AND episode_id = 1801) TO 'simpsons-s18e01.csv'
WITH CSV DELIMITER ',' HEADER ;
# characters.csv
id,name,normalized_name,gender,created_at,updated_at
7,Children,children,,2016-09-29 15:24:20.372136,2016-09-29 15:24:20.372136
12,Mechanical Santa,mechanical santa,,2016-09-29 15:24:20.690947,2016-09-29 15:24:20.690947
...
# locations.csv
id,name,normalized_name,created_at,updated_at
1,Street,street,2016-09-29 15:24:20.189358,2016-09-29 15:24:20.189358
2,Car,car,2016-09-29 15:24:20.213079,2016-09-29 15:24:20.213079
# simpsons-s18e01.csv
episode_id,character_id,location_id,raw_character_text,raw_location_text
1801,1,2,Marge Simpson,Car
1801,2,2,Homer Simpson,Car
1801,2,2,Homer Simpson,Car
1801,1,4,Marge Simpson,Auditorium
1801,2,4,Homer Simpson,Auditorium
...
Converting the data from the database
Table of contents
- Title Page
- Copyright
- Credits
- About the Author
- About the Reviewer
- www.PacktPub.com
- Customer Feedback
- Preface
- Getting Started with D3
- Basic Charts and Shapes
- Working with Hierarchical Data
- Visualizing Graphs
- Working with Geo Data
- Visualizing Streaming Data
- Voronoi Diagrams and Heatmaps
- Custom Shapes and Paths and Using a Brush Selection
- ES6, TypeScript, and External D3.js Libraries