0

I am trying to work with d3.js to create a map using datamaps.github.io and the map is not displaying. I am attaching the code because I need some help to resolve this challenge... I have actually followed this solution on stackoverflow Datamaps are showing small size map of India and I am still not able to resolve it...

<html>
<head>
    <title></title>
    <script src="d3.min.js"></script>
    <script src="topojson.min.js"></script>
    <script src="datamaps.world.min.js"></script>
    <script src="jquery-2.1.4.min.js"></script>

    <script>
        var map = new Datamap({
            element: document.getElementById('container'),
            scope: 'world'
        });
    </script>
</head>
<body>
    <div id="container" style="position: relative; width: 500px; height: 300px;"></div>
</body>

Community
  • 1
  • 1
odins
  • 111
  • 1
  • 5

1 Answers1

0

You probably need to include the scripts the right way. are they locally?

Here is a working jsfiddle referencing the libraries from a remote server:

https://jsfiddle.net/khphaLow/

<script src="//cdnjs.cloudflare.com/ajax/libs/d3/3.5.3/d3.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/topojson/1.6.9/topojson.min.js"></script>
<script src="//datamaps.github.io/scripts/datamaps.world.min.js?v=1"></script>

Hope this helps.

mila_frerichs
  • 94
  • 1
  • 3
  • You changed the code to add an onload event handler function when you copied it to JS Fiddle. – Quentin May 15 '17 at 12:04
  • @mila_frerichs yes the scripts are local – odins May 15 '17 at 13:29
  • @Quentin not on purpose, but it does not change the answer. – mila_frerichs May 15 '17 at 15:02
  • @mila_frerichs — Adding the onload handler *solves the problem* that the person asking the question definitely has. The answer is guessing about what the problem might be without any real evidence. It is possible that the OP *also* has that problem, but given that there is a real problem expressed in the code, that means the answer is probably wrong. – Quentin May 15 '17 at 15:04