Book Image

Data Visualization with D3 4.x Cookbook - Second Edition

By : Nick Zhu
Book Image

Data Visualization with D3 4.x Cookbook - Second Edition

By: Nick Zhu

Overview of this book

Master D3.js and create amazing visualizations with the Data Visualization with D3 4.x Cookbook. Written by professional data engineer Nick Zhu, this D3.js cookbook features over 65 recipes. ? Solve real-world visualization problems using D3.js practical recipes ? Understand D3 fundamentals ? Includes illustrations, ready-to-go code samples and pre-built chart recipes
Table of Contents (21 chapters)
Data Visualization with D3 4.x Cookbook - Second Edition
Credits
About the Author
About the Reviewer
www.PacktPub.com
Customer Feedback
Preface

Creating a scatterplot chart


A scatterplot or scattergraph is another common type of diagram used to display data points on Cartesian coordinates with two different variables. Scatterplot is especially useful when you're exploring the problem of spreading, clustering, and classification. In this recipe, you will learn how to implement a multi-series scatterplot chart in D3.

Getting ready

Open your local copy of the following file in your web browser:

https://github.com/NickQiZhu/d3-cookbook-v2/blob/master/src/chapter8/scatterplot-chart.html

How to do it...

A scatterplot is another chart that uses Cartesian coordinates. Thus, a large part of its implementation is very similar to the charts we introduced so far; and therefore, the code concerning peripheral graphical elements are again omitted to save space in this book. Please refer to the companion code for the complete implementation. Now let's take a look the implementation of this recipe:

... 
 
_symbolTypes = d3.scaleOrdinal(...