D3
OG
Old school D3 from simpler times
All examples
By author
By category
About
FrieseWoudloper
Full window
Github gist
test
<!DOCTYPE html> <head> <meta charset="utf-8"> <script src="https://d3js.org/d3.v3.min.js" charset="utf-8"></script> <style> svg { border: 1px solid red; width: 600px; height: 400px; } </style> </head> <body> <script type='text/javascript'> var w = 600; var h = 400; //setup our display area var svg = d3.select('body') .append('svg') .attr('w',w+'px') .attr('h',h+'px'); //make an path object to convert from geojson paths to svg paths var path = d3.geo.path(); //load the data url = "https://gist.githubusercontent.com/michellechandra/0b2ce4923dc9b5809922/raw/a476b9098ba0244718b496697c5b350460d32f99/us-states.json" d3.json(url, function(json) { //when the json file is loaded // set up the paths for each state svg.selectAll('path') .data(json.features) .enter() .append("path") .attr('d',path) //bind the converter ; }); </script> </body> </html>
Modified
http://d3js.org/d3.v3.min.js
to a secure url
https://d3js.org/d3.v3.min.js