Drawing grid lines
Quite often, we will need horizontal and vertical grid lines to be drawn in consistency with the ticks on both x and y axes. As we have shown in the previous recipe, typically, we don't have, or don't want to have, precise control of how ticks are rendered on D3 axes. Therefore, we might not know how many ticks are present and their values, before they are rendered. This is especially true if you are building a reusable visualization library, where it is impossible to know the tick configuration ahead of its time. In this recipe, we will explore some useful techniques for drawing consistent grid lines on Axis without actually needing to know the tick values.
Getting ready
Open your local copy of the following file in your web ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access