You can clone with
HTTPS or Subversion.
The default formatter for a time-based x axis renders the time within the current order of magnitude, i.e. "Jan", "Feb". However, there is no context that signifies (in this example) the year. The same is true for lower orders of magnitue, e.g. days are missing month and year.
As it makes no sense to display this information every time, this cannot be solved by custom formatters.
Rickshaw should support formatters to display the context in the first tick only and drop it in later ticks, OR to display the context in a second row.
| | ...... |
Jan 2013 Feb ...... Jan 2014
| | ...... | |
Jan Feb ...... Jan Feb
I'm happy to help with a pull request, but I'd like to get input on how this could be done first.
One idea to do this:
A formatter then could:
I agree this is a good problem to solve, and I generally like this direction.
Rather than passing along previous contexts to each next invocation, can we make it simpler and more flexible by just passing the whole list of ticks along with the current index?
That should work. Label formatter could then determine that it is the first tick or that the month/year context changed from the previous tick. It could even do special formatting on the last tick. I like it.
I've dropped this idea for now, and moved to d3's time tick formatter as per #346. It generates the year as a context in a time series, at least when the first month of the year is displayed.
I'm not sure what the future of replicating time formatting outside of d3 is, or whether it makes sense to implement something like this upstream.