javascript - I have an svg element that i want to alter the color of with a button click. Involves, json, and csv -
what code create map projection using g.selectall("path)... assigns small circles perimeters of associated countries. want able create buttons in html file when pressed "select"/"deselect" or color/uncolor circles and/or associated countries. want able choose countries , circles colored. know how create buttons , reference them , such, calling functions them. hangup not sure how svg or g element redraw or reupdate canvas. if debug, shows call stack not going g.selectall more once method executes multiple times. first time writing js forgive inconsistencies or rough code outline.thanks! var svg = d3.select("#container").append("svg") .attr("width", width) .attr("height", height) .append("g"); //create secondary layer canvas svg var g = svg.append("g"); function buildmap() { d3.json("countries.geo.json", function(json) { d3.csv("map_of_the_gods...