jiahuang/d3-timeline — pull request #5 by ryepdx (2013-03-10 04:43:46+00:00)
Title: Added ability to trigger a function on scroll

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).