Open philipnye opened 4 months ago
I wonder - is it possible to use D3 to choose the gridlines and axis labels, but then revert to using the original start and end dates supplied to the chart? It's already the case that there isn't always a gridline at the point where the chart starts and ends. Would doing this introduce other problems?
There is a very simple fix to this: remove the call to the nice() method of the xScale. If you're happy that the bar start / end are provided by either the first start / last end of the timeline or explicitly provided I can make this fix.
@gilesdring Yes, the scripts that I've written will always return both a (finite) start/end date for all bars and a start/end date for the chart as a whole. Just to check we're on the same page - this won't affect the choice of gridlines? I.e. Gridlines would be October (on 1 October) rather than 15 October, say?
It shouldn't do - all that will happen is that the range won't be rounded to a nice value - so if the earliest timestamp was 2:23 am on 15th Oct (for some reason) that's where the chart would start, unless manually overridden. I think the ticks will still fall on sensible points. Can run some testing to validate this assumption.
Confirmed, and removed in code. Will be in next release.
@gilesdring We've tested this and it's looking good, thanks - definitely preferable to what we had before. We wonder if a further refinement is possible:
nice()
has got this as we'd like it)I could probably find the budget for another hour or two if you think a fix would be doable in that time. If it's a more complicated ask, I think we'd live with what we have.
Currently the chart can be drawn from a point before the start date supplied to the chart/to a point after the end date supplied to the chart. This is done to ensure 'sensible' gridlines/axis labels are used but causes two issues:
People who are currently in post can appear to have finished in post because the axis continues beyond 'today' but the bar doesn't NB: We wouldn't want to extend the bar beyond 'today'
We append "(since XXXX)" to bar labels where a bar starts before the start date supplied to the chart, but this is made redundant in some cases because the chart axis range starts before the start date supplied to it This feels less of a big deal than the first one - it's not likely to crop up that often