I have a Tree data structure where each non-leaf node (children) have this object:
mime_types={
"application/octet-stream": 1,
"application/x-executable": 49,
"application/x-object": 13,
"application/x-sharedlib": 47,
"image/gif": 5,
"image/png": 3,
"inode/symlink": 4,
"text/plain": 58
}
Each leaf of my tree have a single type and its relative color (for example, a text/plain leaf will be colored blue). I implemented it doing:
var ListMimes = ['text/plain', 'application/x-executable', 'application/x-sharedlib', 'application/x-object', 'image/gif', 'inode/symlink', 'image/png', 'application/octet-stream']
var myColor = d3.scaleOrdinal().domain(ListMimes).range(d3.schemeSet3);
But for each non-leaf node, i want to color it (i'm drawing a sunburst) in a "proportional" way. I try to explain better: In this example i have text/plain with value 58, so this will "weight" much more than application/octet-stream in the result of the final color. So if text/plain is blue, and application/octet-stream is green, the final color will be blue with a very very little quantity of green
How can i do it using d3?