D3
OG
Old school D3 from simpler times
All examples
By author
By category
About
seasmith
Full window
Github gist
Testing sf data converted to geojson
<!DOCTYPE html> <meta charset="utf-8"> <style> h1, h2 { font-family: "Lato", "Open Sans", "sans-serif"; margin: 0px; padding: 3px; } .text-things { margin-bottom: 8px; } .tract { stroke: rgb(88, 88, 88)} .tract:hover { opacity: 0.5; transition-delay: 500ms;} </style> <div class="text-things"> <h1>Testing sf data converted to geojson</h1> </div> <svg width="960" height="550"></svg> <script src="https://d3js.org/d3.v4.min.js"></script> <script src="d3-tip.js"></script> <script> var svg = d3.select("svg"), margin = { top: 20, bottom:20, right: 20, left: 20}, width = +svg.attr("width"), height = +svg.attr("height"); d3.queue() .defer(d3.json, "rig_counts.json") .await(ready); function ready(error, data) { if (error) throw error; var path = d3.geoPath() .projection(d3.geoAlbers() .fitExtent([[margin.left, margin.top], [width-margin.right, height-margin.bottom]], data) ); svg.selectAll("path") .data(data.features) .enter().append("path") .attr("class", "tract") .attr("d", path); }; </script>
https://d3js.org/d3.v4.min.js