D3js: Time Scaling And "1901"
I'm working with a time-based scatterplot and am using data which only parses times by month, hour and day. On my axis labels, I'm getting '1901'. D3 seems to be choosing a year
Solution 1:
you need to set the tickFormat
of your axis to display only months and days. The tickFormat
receives a function that takes a date and returns a string. You can use d3.time.format
to set the tick format:
var axis = d3.svg.axis()
// ... set more attributes
.tickFormat(d3.time.format('%b %d')); // Abbreviated month and decimal day (Apr 01)
Regards,
Post a Comment for "D3js: Time Scaling And "1901""