D3
OG
Old school D3 from simpler times
All examples
By author
By category
About
AnniWis
Full window
Github gist
fernwaerme2
Built with
blockbuilder.org
<!DOCTYPE html> <head> <meta charset="utf-8"> <script src="https://d3js.org/d3.v4.min.js"></script> <style> body { margin:0;position:fixed;top:0;right:0;bottom:0;left:0; } </style> </head> <body> <script> var width = 960, height = 500, padding = 60; /* ---------- SVG erstellen ---------- */ var svg = d3.select("body") .append("svg") .attr("width", width) .attr("height", height); /* ---------- Projektion definieren ---------- */ var projection = d3.geoMercator() .center([56,59.3]) .scale(112) .translate([width/2, height/2]); /* ---------- path definieren ---------- */ var path = d3. geoPath() .projection(projection); /* ---------- Daten laden ---------- */ d3.json("bezirke_ohne_neuwerk.json", function(json) { /* ---------- Daten anbinden ---------- */ svg.selectAll("path") .data(json.features) .enter() .append("path") .attr("d", path); }) </script> </body>
https://d3js.org/d3.v4.min.js