Description
People are often tempted to apply an ordinal scale (sometimes implicitly via Plot.cell or Plot.bar) to temporal data. This can be misleading because gaps in the data, such as missing days, are not shown. Also, the ordinal scale can’t know the expected regularity of the temporal data, so there’s no way for it to choose an appropriate tick reduction strategy and tick labels are often overlapping.
But what if you told the ordinal scale the expected regularity of the data, say as a D3 time interval? Then the ordinal scale could explicitly compute the complete domain from the extent, e.g. d3.utcDay.range(start, stop), and show any gaps in the data. The ordinal scale could also floor the data using the interval (d3.utcDay.floor(date)) as a scale transform, such that the input dates are forced to align with the expected interval and thus be present in the domain. The ordinal scale could likely even chose an appropriate tick reduction strategy (e.g., every Sunday), at least if it’s a known time interval, or perhaps using interval.every.
Related #74.