Search icon
Subscription
0
Cart icon
Close icon
You have no products in your basket yet
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletters
Free Learning
Arrow right icon
Data Visualization with D3 and AngularJS

You're reading from  Data Visualization with D3 and AngularJS

Product type Book
Published in Apr 2015
Publisher
ISBN-13 9781784398484
Pages 278 pages
Edition 1st Edition
Languages
Authors (2):
Erik Hanchett Erik Hanchett
Profile icon Erik Hanchett
Christoph Körner Christoph Körner
Profile icon Christoph Körner
View More author details

Table of Contents (16) Chapters

Data Visualization with D3 and AngularJS
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
1. The Magic of SVG, D3.js, and AngularJS 2. Getting Started with D3.js 3. Manipulating Data 4. Building a Chart Directive 5. Loading and Parsing Data 6. Drawing Curves and Shapes 7. Controlling Transitions and Animations 8. Bringing the Chart to Life with Interactions 9. Building a Real-time Visualization to Monitor Server Logs Index

Working with scales


In data visualization, we will always have to deal with mapping our dataset to a specific range of pixels. Let me give you an example. We have a dataset [0, 2, 4, 6, 8, 10] that we want to display for mobile and desktop devices. On mobiles, we want to display the dataset with a total width of 480px and on desktops with a width of 1024px. In order to draw the dataset on these pixel ranges, we need to map it to these ranges. We can see this example in the following figure:

Mapping the dataset to a pixel range

D3.js provides a very useful tool to map a dataset to a certain range of pixels: d3.scale. In D3.js, we call the mapping function's scale, the slice of the dataset that we want to map the domain to, and the pixel range on which we want to map the dataset range. In the following figure, we can see a dataset, where only the positive values are mapped to the width of the axis:

Visualizing a scale

In order to represent different data types with scales, we distinguish between...

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 $15.99/month. Cancel anytime}