I work with NVD3 to schedule sun rays. I am new to D3, so I use NVD3 to abstract some more complicated things. Now I am working with a simple example that I got from the Internet, but I'm trying to color the nodes (arcs) based on the size attribute in JSON. I know that NVD3 has the ability to use the color function in the chart options so that what I tried to use is like this:
chart: { type: 'sunburstChart', height: 450, color: function(d) { if (d.size > 3000) { return "red"; } else if (d.size <= 3000) { return "green"; } else { return "gray"; } }, duration: 250 }
But as you can see from plunker , I work on these results only in gray color, because in reality it does not receive values ββfrom d.size (this is just undefined, and I'm not sure why).
Using regular D3, which I am trying to avoid, I can get the result from this:
var path = g.append("path") .attr("class","myArc") .attr("d", arc) .attr("name",function(d){return "path Arc name " + d.name;}) .style("fill", function(d) { if(d.size > 3000) { return "green"; } else if( d.size < 3000){ return "red"; } else { return "gray"; } }) .on("click", click) ...
I modified the regular D3 sunburst example to get it with the desired result:

I know the tags are tight, but that doesn't matter. I would like to get the same result as regular D3, but with an abstraction of NVD3. I have not found any good examples that mention the use of color: function() in general. Thanks in advance.
source share