esbullington / react-d3

Modular React charts made with d3.js
https://reactiva.github.io/react-d3-website/
MIT License
1.76k stars 187 forks source link

Line chart format Date in x axis #342

Open darioenginius opened 7 years ago

darioenginius commented 7 years ago

Hi, I'm trying to format the values on the X axis in Line Chart in order to display a formatted date (DD-MM-YYY or DD/MM, ecc...). In Bar chart it works fine, but not in Line Chart. I read this issue (https://github.com/esbullington/react-d3/issues/70) and the relative documentation (https://github.com/esbullington/react-d3/wiki/Dates), but still doesn't work. I tried multiple times, from the initial value on data object ('2017-01-10', timestamp, new Date(), ecc..), to format in xAccessor (return new Date(d.x) and d3.time.format), and finally in xAxisTickInterval with unit 'year'/'day', but no combination works. I get different errors:

which is the right way to do this? ps: I tried exactly the example on https://github.com/esbullington/react-d3/wiki/Dates but doesn't work.

Thanks.

akuji1993 commented 6 years ago

I'm having the same issue. Getting the string.slice is not a function error, too.