Multiple Axes for a Graph
Explore how to enhance D3 graphs by adding a second y-axis to represent data with different scales. Learn to separate scales, adjust margins, and style axes for clear comparison of multiple lines in one graph.
We'll cover the following...
We'll cover the following...
Let’s imagine that we want to show our wonderful graph with two lines, much like we already have, but imagine that the data that the lines are made from is significantly different in magnitude from the original data (in the example below, the data for the second line has been reduced by approximately a factor of 10 from our original data).
date,close,open
1-May-12,58.13,3.41
30-Apr-12,53.98,4.55
27-Apr-12,67.00,6.78
...
Now, this isn’t a problem in itself. D3 will still ...