简体   繁体   中英

Datamaps isn't showing map of Central America country

I'm trying to build a map of a country named El Salvador with Datamaps. But for whatever reason, it doesn't show and there isn't any warning or error message displayed.

<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.slv.js"></script>
<div id="container" style="position: relative; width: 500px; height: 300px;"></div>
<script>
 var map = new Datamap({element: document.getElementById('container'),scope: 'slv'});
</script>

I'm using the correct library ( https://raw.githubusercontent.com/markmarkoh/datamaps/master/dist/datamaps.slv.js ). The above code works fine if a use a world map (deleting the scope line).

How can I fix this?

您需要为“萨尔瓦多”的位置设置“变换投影”,此位置为[-88.9195598,13.7734784],需要按此顺序设置纬度和经度。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM