Reputation: 10761
Can anyone explain why Janaury is not bening shown on my x Axis?
I'm using this to generate it:
var xAxis = d3.svg.axis()
.scale(x)
.ticks(d3.time.months)
.orient("bottom").tickFormat(d3.time.format("%B"));
Upvotes: 0
Views: 90
Reputation: 634
It's because you don't have any data on or before January 1st, and are calling the domain of the x axis with d3.extent()
, so the axis stops at your lowest value (January 3rd or something around there). Instead of using d3.extent()
, you can manually choose to decide to start your axis on January 1st like so:
x.domain([
new Date('2012/1/1'),
d3.max(data, function(d) { return d.date; })
]);
Upvotes: 1