how to convert the full month name to abbreviated name by this function
axis.ticks(d3.time.months, 1)
this function prints the months name in full january February
What should i use to change it to abbreviated names.
You can add a timeFormat, like this:
axis.ticks(d3.time.months, 1)
.tickFormat(d3.time.format("%b"));
The accepted answer was answered before d3 version 4 release. If you want to do the same with d3 version 4, do it like this:
axis.ticks(d3.timeMonth, 1)
.tickFormat(d3.timeFormat('%b'));
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With