This diverges from the behavior of python's range() but seems more correct for display purposes.
Scale.ticks returns a single value for a degenerate domain.
I'm curious why you want this behavior. A scale with a degenerate domain isn’t particularly useful, since it maps every value to the start of the range. So displaying any tick values would probably be misleading, or at any rate, also not very useful. :)
Yeah, handling a useless scale is precisely what I need because I'm creating scales dynamically based on the min/max values from database queries.
Here's an example for a single chart using a fixed number of ticks and different data. http://bl.ocks.org/4617865 notice when there is one domain value, no labels appear. In my application the charts need to handle arbitrary data so locking them to a fixed scale is not an option.
It seems like the best solution for correctly labeling the domain when n=1 is to pad the min and max values e.g.
var xScale = d3.scale.linear()
.domain([d3.min(data, xSelector) - 0.01, d3.max(data, xSelector) + 0.01])
Yeah, I think it'd probably be best to detect a degenerate domain in this case, and then pad it by some fixed value on both sides, and in that case request only 1 tick rather than 5 or whatever you normally use.
Unrelated, but I just visited your website and found your WebGL contours map, and I thought it was really cool. :) I liked the satellite visualization hooked up to crossfilter too!
Glad you like them! Make sure you check out the bike map too: http://bdon.org/bicycle.html . My site does not have nearly as many epic demos as yours yet, but I'm working on it :)