-
Notifications
You must be signed in to change notification settings - Fork 999
Open
Description
I want to show a map of Switzerland. I assume the used abbrevation in the library is swz.
With the datamaps.swz.min.js approach, I get a blank page. But works with usa.
<script src="https://cdnjs.cloudflare.com/ajax/libs/d3/3.5.3/d3.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/topojson/1.6.9/topojson.min.js"></script>
<!-- with scope usa: shows usa -->
<!--<script src="lib/datamaps.usa.min.js"></script>-->
<!-- with scope swz: shows nothing -->
<script src="lib/datamaps.swz.min.js"></script>
<div id="container" style="position: relative; width: 500px; height: 300px;"></div>
<script>
var map = new Datamap({
element: document.getElementById('container'),
// scope: 'usa' // works with "datamaps.usa.min.js"
scope: 'swz' // blank page with "datamaps.swz.min.js"
});
</script>With the datamaps.all.min.js approach, I get an error Uncaught TypeError: Cannot read properties of undefined (reading 'swz'). But works with usa.
<script src="https://cdnjs.cloudflare.com/ajax/libs/d3/3.5.3/d3.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/topojson/1.6.9/topojson.min.js"></script>
<script src="lib/datamaps.all.min.js"></script>
<div id="container" style="width: 500px; height: 300px;"></div>
<script>
var map = new Datamap({
element: document.getElementById('container'),
scope: 'usa',
// scope: 'swz', // not working, getting error "Uncaught TypeError: Cannot read properties of undefined (reading 'swz')"
});
</script>Metadata
Metadata
Assignees
Labels
No labels