novus / nvd3

A reusable charting library written in d3.js
http://nvd3.org/
Other
7.22k stars 2.14k forks source link

2 line/scatter series with same x and y values gives error when using voronoi #368

Closed sizeight closed 9 years ago

sizeight commented 10 years ago

Rendering a chart with the 2 series below causes a JS error with D3V3 but works fine with D2V2. The 2 series have the exact same 5th value of 1.07, and this causes the error. Error message: Uncaught TypeError: Cannot read property 'data' of undefined

[
    {
        "key": "Series 1" ,
        "values": [[1030752000000,11.42],[1033344000000,12.08],[1036022400000,12.32],[1038614400000,11.37],[1041292800000,11.07]]
    },
    {
        "key": "Series 2" ,
        "values": [[1030752000000,11.5],[1033344000000,12.24],[1036022400000,12.6],[1038614400000,11.7],[1041292800000,11.07]]
    }
]
menes127 commented 10 years ago

For nvd3 1.1.14b, I have changed nvd3.js attached, seems like ok. hope help you. fixed2serieswithsamevalueonsamedategiveserror

sizeight commented 10 years ago

Thanks @menes127, I tested and it seems to fix the problem.

m48u commented 10 years ago

will this be fixed in next releaes? BTW: using "useInteractiveGuideline(true)" won't raise errors with d3v3 3.3.10/11

engineersamuel commented 10 years ago

This one has been bugging me for months now so submitting a pull request based on @menes127 suggestion which seems to do the trick.

liquidpele commented 9 years ago

This looks to still be an issue in the stackedAreaChart example if you use regular tooltips and not the guideline. Interestingly I couldn't reproduce errors with the lineChart though...

liquidpele commented 9 years ago

Okay, I think https://github.com/novus/nvd3/pull/880 will fix this, although I'd like a better solution eventually, please let me know if anyone still has issues with it!