how to display "year" labels correctly in d3.parcoords.js

26 views
Skip to first unread message

Frankie Zhou

unread,
May 25, 2016, 7:04:31 PM5/25/16
to d3-js
Hi all,
My data has a column of "year", which is different year values, such as 1980, 1999, 2016. However, when I use d3.parcoords.js visualize the data, the labels on "year" axis display as scientific number format, i.e. "1980"-->"1,980", "2016"-->"2,016". May I know how to customize the labels to display as we expect? Thanks!
Frankie

Curran

unread,
May 28, 2016, 11:05:05 AM5/28/16
to d3-js
Hello,

Parsing the years into Date objects might do the trick, but I'm not sure how d3.parcoords.js would handle that exactly:

d.year = new Date(d.year, 0)

Another solution might be to override the number format for the axis with the identity function:

axis.tickFormat(function (d){ return d; });

If you can share your code on bl.ocks.org (maybe using Blockbuilder), folks can have an easy time to take a look and try to help make it work. Your question is difficult to answer in a precise way without seeing the code.

Best Regards,
Curran
Reply all
Reply to author
Forward
0 new messages