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