Set the charset of your document to
utf-8 right at the beginning of the HTML head section, then include the downloaded dependencies, and in the body create a
div with the id
Setting the charset to
utf-8 is mandatory, because d3, d3-geo-projection and several of the TopoJSON files contain characters that may not work with the default encoding otherwise set by the browser.
In the other examples on this site inclusion of this code is assumed and not repeated on every page.
<html> <head> <meta charset="utf-8"> <link href="/d3-geomap/css/d3.geomap.css" rel="stylesheet"> <script src="/d3-geomap/vendor/d3.geomap.dependencies.min.js"></script> <script src="/d3-geomap/js/d3.geomap.min.js"></script> </head> <body> <div id="map"></div> </body> </html>
var map = d3.geomap() .geofile('/d3-geomap/topojson/world/countries.json') .draw(d3.select('#map'));
Either add the above code between