Skip to content
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

Map for switzerland (swz?) not working #551

Open
fabpico opened this issue Jul 14, 2023 · 0 comments
Open

Map for switzerland (swz?) not working #551

fabpico opened this issue Jul 14, 2023 · 0 comments

Comments

@fabpico
Copy link

fabpico commented Jul 14, 2023

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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant