Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Save more on your purchases now! discount-offer-chevron-icon
Savings automatically calculated. No voucher code required.
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Learn D3.js

You're reading from   Learn D3.js Create interactive data-driven visualizations for the web with the D3.js library

Arrow left icon
Product type Paperback
Published in May 2019
Publisher Packt
ISBN-13 9781838645571
Length 650 pages
Edition 1st Edition
Languages
Tools
Arrow right icon
Author (1):
Arrow left icon
Helder da Rocha Helder da Rocha
Author Profile Icon Helder da Rocha
Helder da Rocha
Arrow right icon
View More author details
Toc

Table of Contents (13) Chapters Close

Preface 1. Introduction FREE CHAPTER 2. Technical Fundamentals 3. Quick Start 4. Data Binding 5. Manipulating Data and Formatting 6. Scales, Axes, and Colors 7. Shape and Layout Generators 8. Animation and Interactivity 9. Visualizing Hierarchical Data 10. Visualizing Flows and Networks 11. Visualizing Geographical Data 12. Other Books You May Enjoy

Scales

Scales map abstract dimensions to visual representations. They are functions that receive a value in one dimension (usually a dimension that fits the input data) and return a corresponding value in another dimension (usually a dimension that represents output variables that are used in the visualization, such as positions, lengths, or colors).

For example, if your data consists of a list of 20 values (between 0 and 1,000) and you wish to plot them on a 700 x 500 Cartesian grid using all the space available, you need to multiply each value so that its position is proportional to the space available. To fit the 20 items on the x axis, for example, you might divide 700 by 20 and multiply it by the index of each data item. Multiplying each value by 0.5 will squish the [0,1000] domain proportionally on the y axis.

If you add more values, you have to recalculate everything again...

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime