-
Notifications
You must be signed in to change notification settings - Fork 22.9k
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
Something wrong with the http://d3js.org/d3.v3.min.js package #1693
Comments
The most likely explanation is that you are loading D3 on a page that has an Asynchronous Module Definition (AMD) API available. In this case, as of D3 3.4.0 which was released earlier today, D3 is exported via the require.config({
paths: {
d3: "http://d3js.org/d3.v3.min"
}
});
require(["d3"], function(d3) {
console.log(d3.version);
}); D3 does not export the global If this didn’t solve your problem, let me know more details and I will reopen this issue. Thank you and sorry for the breakage! |
Yep, that is probably it. I'll update the code shortly. Thanks! Kevin On Fri, Jan 10, 2014 at 3:12 PM, Mike Bostock notifications@github.comwrote:
|
Hello, I'm having some problems with some d3 dependencies. Here is my code:
Checking on the Network panel of debugging tools I can see the three libraries are loaded in the correct order, but geoprojection is complaining that d3 is not defined! Here is what I get in the console:
Am I missing something simple here? What is the correct way of loading these dependencies? Thanks |
The main problem here is that the d3.geo.projection plugin depends on the Fortunately, it’s not too cumbersome to define an intermediate dependency ("d3.global") that defines the global so that it is available to the plugin. Like so: require.config({
paths: {
"d3": "http://d3js.org/d3.v3.min",
"d3.geo.projection": "http://d3js.org/d3.geo.projection.v0.min",
"topojson": "http://d3js.org/topojson.v1.min"
},
shim: {
"d3.geo.projection": ["d3.global"]
}
});
define("d3.global", ["d3"], function(_) {
d3 = _;
});
require(["d3", "topojson", "d3.geo.projection"], function(d3, topojson) {
console.log(d3.geo.aitoff);
}); |
I just ran into this problem with dc.js, which still assumes a d3 global. This is the key from the RequireJS docs that explains the problem:
@mbostock, should that say |
D3 will export a global, but only if require is not available on the page. If you load D3 on a page with require, you must use require to load D3 rather than loading a bare script tag. If you are loading another library that requires D3 as a global, you can export it as a global after requiring it (or you could rewrite the library to not depend on a global). |
Uncaught ReferenceError: d3 is not defined d3/d3#1693
ReferenceError: d3 is not defined -- after moving sankey from html to js? I tried many ways to apply Mike Bostock's RequireJS directions above to BootstrapJS without success. Appreciate help: |
@cliveb As I mentioned at the end of my last comment, it only worked for me if the line is |
Using |
Connecting to: HTTP://d3js.org/d3.v3.min.js is OK Where can I find a link to HTTPS:://d3js.org/d3.v3.min.js ? |
Can't remember how I solved or hacked a d3 solution Browser Vendors enforcing https over http notching up security for web clive || http://about.me/cliveboulton On Fri, May 8, 2015 at 6:01 AM, JohnGilmore100 notifications@github.com
|
I asked a Googler on Chrome Polymer/Web team how to solve this. "Polymer/Web Components don't have anything to do with security. Imports As for creating a custom element that uses d3, that should be fine." clive || http://about.me/cliveboulton On Fri, May 8, 2015 at 7:56 AM, clive boulton clive.boulton@gmail.com
|
Unfortunately, I haven’t yet setup HTTPS when using custom domains over GitHub Pages—I need to signup for Cloudflare or something similar. In the meantime, I recommend using a CDN that supports HTTPS, such as CDNJS: |
Thanks all. Mike - same feedback:
|
d3/d3#1693 (cherry picked from commit 12f8baf)
This may or may not be related, but when developing on the file system in firefox (i.e. not using http-server or the like) the following (as recommended by https://d3js.org/) does not work for me:
However, using the following
does work. @mbostock, is the exclusion of the http: from the recommendation on https://d3js.org/ intentional? If not, it might be helpful for a large number of users to add it in. |
The |
Thanks. Would it make sense to prefix |
Sure, I’ve updated d3js.org and the wiki to recommend HTTPS. |
All of sudden all my applications that reference http://d3js.org/d3.v3.min.js broke. I'm getting a d3 reference not found error. When I go to the downloaded version, that I downloaded a month or two ago, everything works fine. Was there some new push that came out sometime this past week or two?
Thanks!
The text was updated successfully, but these errors were encountered: