D3.js Axes, Ticks, and Gridlines

See the original posting on DZone Python

This article explains how to use scale, axis, and ticks methods to implement axes, ticks, and gridlines on D3.js charts. I will introduce some of the many D3.js methods that will allow you to customize your chart axes.

It is important to remember that the type of scale we use affect what axis methods we can use. D3.js provides many different types of scales. Some of these axis methods that we will discuss only apply to certain scales. In this case, we will focus on a bar chart, that has scaleBand on the horizontal direction, and scaleLinear on the vertical direction. This should cover most use cases.