6. Sizing Charts and Adding Axes

This chapter covers how to use scales and easily create axes in D3. Scales make it straightforward to translate values in a data set to pixels on a screen. Axis generators make it exceedingly simple to add axes to your charts and customize them. By the end of the chapter, you will have created our single-year bar chart example using D3 to its fullest potential.

Linear Scales

In this chapter we are going to build on our population bar chart example from the very beginning. So go ahead and open up the most recent version, pop2010-data-joins.html, in both your browser and your text editor.

Remember in the chapter on SVG, we covered the transform attribute. Using the transform attribute, you can translate an SVG element ...

Get Visual Storytelling with D3: An Introduction to Data Visualization in JavaScript™ now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.