-
Notifications
You must be signed in to change notification settings - Fork 40
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Including d3-fetch.v1.js causes d3.svg to be undefined in nv.d3.js #37
Comments
Sounds like both d3-fetch and NVD3 define d3.svg, so you won’t be able to use them together. Sorry! |
Generally, you can't include d3@3 and d3@4+ in the same HTML file. I needed to load d3v4-force into a d3@3 project and I had luck using rollup to produce a bundle that exposed the d3@4 code as https://github.com/dc-js/dc.graph.js/blob/develop/d3v4-force.rollup.config.js (Doing a sed search-and-replace also worked, but this is more elegant.) |
Why does something designed for fetching data define d3.svg?
I was aware the NVD3 couldn't use d3 v4, but I thought I was avoiding that, following their examples. I'm not using node, so I'm not sure how to incorporate your solution. |
Oh I see, you parse SVG. I think I'll just modify my copy to change the definition. |
Or maybe you could make everything live under |
Sorry, but I’m not going to rename this method. The d3.svg namespace was removed from D3 in 4.0 which was released in 2016. This module added a new d3.svg method (parallel to d3.xml, d3.text, d3.json, etc.) in 2018. |
d3-fetch is circa d3@5 so it’s not compatible with d3@3 used by NVD3. My rollup solution has nothing to do with Node. It’s just a way to bundle individual D3 ES6 modules to replace It’s basically the same way the official D3 bundles are created. |
Ah I see. Well, I did search and replace, which worked, but then couldn't get NVD3 to do what I wanted, to I switched to C3. |
By process of elimination, I've determined that an error in I get while running the NVD3
lineChart()
example comes from includingd3-fetch.v1.js
in the same HTML file. The error reported by Safari is "TypeError: d3.svg.axis is not a function. (In 'd3.svg.axis()', 'd3.svg.axis' is undefined)".This goes away if I don't include d3-fetch, but I need that for…fetching data.
The text was updated successfully, but these errors were encountered: