yang-wei / rd3

react + d3
https://yang-wei.github.io/rd3/
MIT License
319 stars 83 forks source link

ToolTip fails in LineChart for Date objects #42

Open ebertmi opened 8 years ago

ebertmi commented 8 years ago

I've some data series which look like this:

let series = [{
 name: 'test',
 values: [{date: new Date(), count: 3}]
}];

I forked the LineChart Fiddle to demonstrate the problem: https://jsfiddle.net/Le5vt2ot/

After some debugging I found the error in Line 81 in DataSeries.js: if (Object.prototype.toString.call(xAccessor(point)) === '[object Date]') {

The point object as this place has only a x and y value, but no date or count as expected by the accessor. Therefore, the call fails and returns null/undefined.

yang-wei commented 8 years ago

Thanks for reporting.

Looks like this is a bug =(

dmk23 commented 8 years ago

any update / ETA on the fix?

fawazlab commented 8 years ago

I believe the open pull request #69 will fix this issue.

themre commented 8 years ago

My override works: tooltipFormat={d => { return String(moment(d.xValue).format("YYYY-MM-DD")) }}