markmarkoh / datamaps

Customizable SVG map visualizations for the web in a single Javascript file using D3.js
http://datamaps.github.io
MIT License
3.78k stars 1.01k forks source link

Unrecognizable src script #529

Open pietrobanana opened 3 years ago

pietrobanana commented 3 years ago

My program is not able to recognize new Datamap, this happened when I changed the pointed package from the nodes_module component to the link.

Any idea why this isn't working?

pietrobanana commented 3 years ago
<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.world.min.js"></script>
<div id="container" style="position: relative; width: 1000px; height: 600px;"></div>
<script>
var map = new Datamap({element: document.getElementById('container'),
    scope: 'world',
    geographyConfig: {
        highlightFillColor: '#E07300',
        popupTemplate: function(geography, data) {
            return '<div class="hoverinfo">' + geography.properties.name + ' residencies:' +  data.residencies + ' '
        },
    },  
    fills: {
        defaultFill: '#0D7A9E'
    },
pietrobanana commented 3 years ago

It seems the problem was fixed by replacing the min file in line 3 with:

If anyone has other suggestions of better practices please let me know. Thanks.

Spensiir commented 3 years ago

I'm also unable to use the Datamaps API. I'm importing the script via: <script src="http://datamaps.github.io/scripts/0.4.4/datamaps.usa.min.js"></script> but i am getting the following error in my console when I try to instantiate a new datamap: Uncaught TypeError: Cannot read property 'equirectangular' of undefined