Skip to content Skip to sidebar Skip to footer

D3 Choropleth Map: Colors Are Not Appearing

I am having issues with Choropleth Map using D3. I want to show occurrences of disaster to the World Map for the given year, say 2015. I have a dropdown to change disaster type. I

Solution 1:

Instead of:

countries.attr("d", path)
    .attr("stroke", "gray")
    .attr("fill", function(d) {
        var value = d.properties[occurrence];
        if (value) {
            returncolor(value);
        } else {
            return"#aaa";
        }
    });

Try:

d3.selectAll("path)
    .attr("stroke", "gray")
    .attr("fill", function(d) {
        var value = d.properties[occurrence];
        if (value) {
            return color(value);
        } else {
            return "#aaa";
        }
    });

Post a Comment for "D3 Choropleth Map: Colors Are Not Appearing"