Reputation: 4643
it would be great to clarify how colors are calculated when ploting treemap (I use gvisTreeMap
function from R googleVis
library).
minColorValue
to maxColorValue
"? Usually I use treemap to display sales (size) and sales difference (color). So ideally I would like to color rectangles so that I can distinguish positive from negative growth, which as I understand is not possible at the moment.Upvotes: 3
Views: 3057
Reputation: 925
If I have understood your problem correctly, I believe the following will solve it:
Let's say your data is percentages, so can go from 0 to 100. Set minColorValue=-100
and maxColorValue=100
(Or if using a different range, just set it so that the min value is the negative of the max value so that the average is 0.)
Then, if you set the colours to, for example, minColor='red'
and maxColor='green'
, this should solve part 1 (negative values will be displayed in red, and positive in green)
Also, it seems that setting maxColor and minColor fixes the average value the colors are calculated from, so that this also solves part 2 (that is, -25 will then always have the same color in the graph)
Upvotes: 5
Reputation: 26330
Color is computed as the average color value of all child nodes of a branch. A branch with no child nodes uses the color value from the DataTable. This color value is then scaled on the minColorValue
to maxColorValue
scale, and a color is computed between minColor
and maxColor
based on the scale.
Colors are not relative to other nodes on the graph - the size of the node is relative.
Upvotes: 4