What is the d3.js v4.0 equivalent for d3.scale.category10()?

Instead of d3.scale.category10() use d3.scaleOrdinal(d3.schemeCategory10); Create a color scale like this: var color = d3.scaleOrdinal(d3.schemeCategory10); use the color like this in the code same as in V3: svg.append(“rect”) .attr(“x”, 10) .attr(“y”, 10) .attr(“width”, 100) .attr(“height”, 100) .style(“fill”, color(3)) read here Reference here working code here

How do I remove all children elements from a node and then apply them again with different color and size?

Your answer will work, but for posterity, these methods are more generic. Remove all children from HTML: d3.select(“div.parent”).html(“”); Remove all children from SVG/HTML: d3.select(“g.parent”).selectAll(“*”).remove(); The .html(“”) call works with my SVG, but it might be a side effect of using innerSVG.

Difference between GeoJSON and TopoJSON

If you care about file size or topology, then use TopoJSON. If you don’t care about either, then use GeoJSON for simplicity’s sake. The primary advantage of TopoJSON is size. By eliminating redundancy and using a more efficent fixed-precision integer encoding of coordinates, TopoJSON files are often an order of magnitude smaller than GeoJSON files. … Read more