esbullington / react-d3

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

using dates in linechart as x axis not working #338

Open aTylerRice opened 7 years ago

aTylerRice commented 7 years ago

I've tried multiple things to get this worker even tried the solution in the other issue, but to no avail.

I have an x axis that is passing in unix dates in the x function like so:

x = function(d) {
     return d.x;
   }

then here is my line chart code:

var dateFormatter = d3.time.format("%d-%m-%Y");
tickDateFormatter = function(d) {
     console.log(d);
    return dateFormatter(new Date(d.x));
  }
<LineChart data={downloadChartDataPoints} chartSeries={chartSeries} x={x} xAxisTickCount={30}
  xAxisTickFormat={tickDateFormatter} />

I am still getting the x label output as the unix timestamp numbers rather than the formatted date. If I remove the x function from the props from linechart I get an error that says x function doesn't exist.