score:0

Accepted answer

Thanks for your effort.

Your syntax is slightly off, and you always want to work with JavaScript Date objects when using D3 time scales. Only the ticks and labels (output) will be formatted as strings, all input will be Dates.

.domain() always takes an array.

You want

var minDate = dateDim.bottom(1)[0].day; // Date object
var maxDate = dateDim.top(1)[0].day;

.x(d3.scaleTime().domain([minDate, maxDate]))

Not sure if these are the only problems - everything else looks okay but it's hard to tell without trying.

Just keep studying, look very closely at what the examples are doing, you'll pick it up quickly!

EDIT: you will find examples where the dates are formatted as strings with an ordinal scale on input. There are only particular cases where is this a good idea, and I don't think this is one of them.


Related Query