I wanted to display the current year of the leftmost date as a hovering text tag above the timeline. I added a scroll function that takes a callback that gets called when the timeline is scrolled. The callback gets passed the scale-corrected leftmost visible x-axis point and the x-axis scale object. In my case I just called "scale.invert(x).getFullYear()," but one could just as easily use the provided parameters to grab dates at any fixed point relative to the timeline's visible window (as demonstrated in example.html).
I wanted to display the current year of the leftmost date as a hovering text tag above the timeline. I added a scroll function that takes a callback that gets called when the timeline is scrolled. The callback gets passed the scale-corrected leftmost visible x-axis point and the x-axis scale object. In my case I just called "scale.invert(x).getFullYear()," but one could just as easily use the provided parameters to grab dates at any fixed point relative to the timeline's visible window (as demonstrated in example.html).