The order of values for ordinal scales is the order in which you give them to .domain()
. That is, simply pass the order you want to .domain()
and it should just work.
The problem you're having with the circles and labels lining up is because you're not taking the size of the range bands into account. That is, the circles will be positioned at the start of a range band and the labels at the center. The code for setting the x coordinates should be something like
.attr("cx", function (d) { return x(d[axes.xAxis]) + x.rangeBand()/2; })
Also note that you might want to sort the numbers passed to x.domain()
-- currently the last value is less than the value before that.
Regarding the "jitter", one easy way of doing that is to add a small random number to the coordinates of the circle. There's no explicit support for that in d3, but it's straightforward to implement.