Coder Social home page Coder Social logo

Comments (29)

markmarkoh avatar markmarkoh commented on May 30, 2024

Are you using amd specific builds of d3/topojson?

from datamaps.

perks avatar perks commented on May 30, 2024

I'm using the libraries found here (which are the latest stable):

from datamaps.

markmarkoh avatar markmarkoh commented on May 30, 2024

I think you left off a url/src..

from datamaps.

perks avatar perks commented on May 30, 2024

I'm using the official latest stable libraries found here, downloaded locally:
d3 : https://github.com/mbostock/d3/blob/master/d3.js
topojson: https://github.com/mbostock/topojson/blob/master/topojson.js

Both claim to be AMD compliant, there is a bit in both that look like --

d3:

  if (typeof define === "function" && define.amd) {
    define(d3);
  } else if (typeof module === "object" && module.exports) {
    module.exports = d3;
  } else {
    this.d3 = d3;
  }
....

topojson:

  function noop() {}

  if (typeof define === "function" && define.amd) define(topojson);
  else if (typeof module === "object" && module.exports) module.exports = topojson;
  else this.topojson = topojson;
}();

Sorry about that my post must have been sent a bit early

I've also tried various combinations of Shim vs. no Shim, etc.

from datamaps.

markmarkoh avatar markmarkoh commented on May 30, 2024

Can you update the path for datamaps to: 'http://rawgithub.com/markmarkoh/datamaps/amd-issues/dist/datamaps.all' and let me know if that fixes it for you?

from datamaps.

perks avatar perks commented on May 30, 2024

Wow yup! Fixed it quite well. Do you know what was the problem, just for future reference?

Thanks so much!

from datamaps.

Mafi78 avatar Mafi78 commented on May 30, 2024

Hi Mark,
I am also having trouble setting up Datamaps with require.js
I tried to follow your link, but it seems it does not work anymore or the content is removed?
Can you help me out ?

from datamaps.

markmarkoh avatar markmarkoh commented on May 30, 2024

Hi @Mafi78, the actual url is: https://raw.github.com/markmarkoh/datamaps/amd-issues/dist/datamaps.all.js

Let me know if that works and I'll send a pull request to get this in master.

from datamaps.

Mafi78 avatar Mafi78 commented on May 30, 2024

Hi Mark,
I got it up and running with your modification!
http://scn.sap.com/docs/DOC-52807
I think you can include it in your master.
Best regards and thank you!
Manfred

from datamaps.

walterra avatar walterra commented on May 30, 2024

Solves it for me too, thanks!

from datamaps.

markmarkoh avatar markmarkoh commented on May 30, 2024

Merged.

from datamaps.

bitoiu avatar bitoiu commented on May 30, 2024

this fixed it for me as well. I see this was merged, but was a release made with this? I used the file referenced in the getting started and I still had issues. thanks for the fix though.

from datamaps.

markmarkoh avatar markmarkoh commented on May 30, 2024

Yes there should have been a release on bower and the download links provided on the home page. How are you referencing the file?

from datamaps.

bitoiu avatar bitoiu commented on May 30, 2024
requirejs.config({
  baseUrl: '/scripts',
  paths : {
    //jquery: "http://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min",
    d3: "http://d3js.org/d3.v3.min",
    topojson: "http://d3js.org/topojson.v1.min",
    datamaps: "/scripts/datamaps.all.min",
    dcc : "/scripts/dcc",
    domReady : "/scripts/domReady"
  }
});

And then when I load it

requirejs(["datamaps", "domReady!"],
  function(datamap) {

    var map = new datamap({element: document.getElementById('mapContainer')});

  }
);

This works with the file posted here from the branch, not with the minified one I downloaded from the website. Note: although the filename is still min.js, I overwrote the contents with the one found in this post.

from datamaps.

markmarkoh avatar markmarkoh commented on May 30, 2024

When did you last edit /scripts/datamaps.all.min?

from datamaps.

bitoiu avatar bitoiu commented on May 30, 2024

Today, it was the first time using it. I can replace the contents from the latest on github again if you think I picked up the latest file from a branch or an old tag, but I doubt it.

from datamaps.

markmarkoh avatar markmarkoh commented on May 30, 2024

It appears I'm having an issue with the min files being deployed. The non-minified version should have the require changes. Give me a few minutes to figure out what the issue is with deploying.

Thanks for pointing this out!

from datamaps.

bitoiu avatar bitoiu commented on May 30, 2024

No worries @markmarkoh , great job with datamaps, thanks for taking a look at it.

from datamaps.

markmarkoh avatar markmarkoh commented on May 30, 2024

Thanks!

Can you try this file?

from datamaps.

bitoiu avatar bitoiu commented on May 30, 2024

I don't get a link from this file :(

from datamaps.

markmarkoh avatar markmarkoh commented on May 30, 2024

Yikes, Can you try this file?

from datamaps.

bitoiu avatar bitoiu commented on May 30, 2024

one sec ;)

from datamaps.

bitoiu avatar bitoiu commented on May 30, 2024

@markmarkoh, I get this:

Uncaught Error: Module name "d3" has not been loaded yet for context: _
http://requirejs.org/docs/errors.html#notloaded 

If I revert back to the file from this page it works like a charm. I named my d3 module d3 as seen above in paths, so I guess if datamaps is requiring it as d3 it should work.

from datamaps.

WunderBart avatar WunderBart commented on May 30, 2024

I'm having the same issue, @bitoiu. It happens with minimized versions only though. Right now as a workaround I require d3 globally (before anything else is loaded) and it works fine. Any ideas how to make it work properly, @markmarkoh?

from datamaps.

liorwohl avatar liorwohl commented on May 30, 2024

hi,
I'm trying to integrate datamaps into my project which use Browserify with NPM.
there are two problems:
require('datamaps');
wont work because your package.json file dont have "main" attribute, so adding:
"main": "dist/datamaps.all.js",
to datamaps/package.json fix it (but its a temp fix until you commit it)

the other problem which I cant figure how to fix is the same problem as in this bug, when doing:
var d3 = require('d3');
require('topojson');
require('datamaps');
I get the error: "Include d3.js (v3.0.3 or greater) and topojson on this page before creating a new map"
In the console watch i see that d3 is there, but topojson is undefined.
what can I do?

I tried with https://raw.githubusercontent.com/markmarkoh/datamaps/amd-issues/dist/datamaps.all.js
and with https://raw.githubusercontent.com/markmarkoh/datamaps/master/dist/datamaps.usa.min.js
but its giving the same error

thanks

from datamaps.

liorwohl avatar liorwohl commented on May 30, 2024

i found a quick ugly fix - adding
script src="http://cdnjs.cloudflare.com/ajax/libs/topojson/1.6.19/topojson.min.js"> /script>
in the head tag fix the problem.
but i would really like to use require()...

from datamaps.

timaschew avatar timaschew commented on May 30, 2024

Please reopen this issue, it's not fixed yet.

I'm using latest versions of these modules, installed via npm and I still get the error

Uncaught Error: Include d3.js (v3.0.3 or greater) and topojson on this page before creating a new map

from datamaps.

markmarkoh avatar markmarkoh commented on May 30, 2024

Can you share the source of how you are loading up DataMaps? <script> tags, require(), import, etc.

from datamaps.

Ushanta avatar Ushanta commented on May 30, 2024

capture
capture

Hi Mark

Can you help me with this issue:

I am using datamaps in conjunction with requirejs. I get an 'undefined' object when injecting the datamaps.world.min.js. I have also tried https://raw.githubusercontent.com/markmarkoh/datamaps/amd-issues/dist/datamaps.all.js.

If you look at the screenshot the other objects (topojson, d3, elasticsearch) are all found.

from datamaps.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.