Accepted answer

The country's color will depend on a value. So the color IS a function of "value". To do that you must to define a range of color based on your values:

var color = d3.scale.linear()
                      .domain([mn,mx])      // <--- min and MAX of your value

then define the color of your country:

                  .style("fill", function(array_values) {
                        return color(array_values[]);

Must-Read: Jerome Cukier - d3: scales, and color

Related Query

More Query from same tag