D3.js - secondary axis alignment -
I've been looking for a long time, it seems that I'm not the only one to ask, but no one works right now Answer:
Normally, how can we align a secondary axis in D3 (Y2 tix in front of Y1 tix)?
I am not specifically looking for a little code; Even a common idea or algorithm can help me?
jsfiddle.net/jugal/3qdkc/
Any clues?
You use the scale to convert the provincial (screen) coordinate values back to the original domain You can. Keeping this in mind, the process
- get the estimated values for the first axis, if you want them to be tick values, use
scale.ticks ()To convert them to screen coordinates, pass the scale first. - Now assign those values to the
scale. Invert ()for the second axis scale, it will value you in the domain of second scale. - Pass those letters next to the
.tickValues ()second axis.
Comments
Post a Comment