O'Reilly logo

Visual Storytelling with D3: An Introduction to Data Visualization in JavaScript™ by Ritchie S. King

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required