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
map. Setting the charset to
utf-8 must be done to ensure that the referenced dependencies and data files don't cause encoding issues in 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/d3-geomap.css" rel="stylesheet"> </head> <body> <div class="d3-geomap" id="map"></div> </body> <script src="//unpkg.com/d3@5/dist/d3.min.js"></script> <script src="//unpkg.com/topojson@3/dist/topojson.min.js"></script> <script src="/d3-geomap/d3-geomap.min.js"></script> </html>
var map = d3.geomap() .geofile('/d3-geomap/topojson/world/countries.json') .draw(d3.select('#map'));
Either add the above code between