Treemap color problem

156 views
Skip to first unread message

NA

unread,
Jun 9, 2011, 4:02:45 PM6/9/11
to Google Visualization API
Hi,

I seem to be having a problem with the colors in my Treemaps. An
example is below (it can be copy and pasted into the Visualization
Playground).

Here's the situation:

- I've defined column 4 to have the same values as column 3. This
should mean that color will be assigned according to size (same size
means you get the same color).

- When you look at the treemap, Asia is bigger than America. This is
correct.

The problem is that Asia has nearly the same color as America. In
fact, if you watch the scale while moving your mouse back and forth
from America to Asia, you'll see that the color for America is a
little *higher* than that for Asia.

What's going on here? This has been confusing me for a while, and I'm
nearly convinced it's a bug.

thanks for any tips on what's happening. Snippet below.



function drawVisualization() {
// Create and populate the data table.
var data = new google.visualization.DataTable();
data.addColumn('string', 'Location');
data.addColumn('string', 'Parent');
data.addColumn('number', 'Market trade volume (size)');
data.addColumn('number', 'Market increase/decrease (color)');
data.addRows([
["Global",null,0,0],
["America","Global",0,0],
["Europe","Global",0,0],
["Asia","Global",0,0],
["Mexico","America",1,1],
["Canada","America",3,3],
["France","Europe",20,20],
["Germany","Europe",1,1],
["China","Asia",1,1],
["Japan","Asia",2,2],
["xxx","Asia",2,2],
["yyy","Asia",2,2],
["xzzzxx","Asia",2,2],
]);

// Create and draw the visualization.
var treemap = new
google.visualization.TreeMap(document.getElementById('visualization'));
treemap.draw(data, {
minColor: 'red',
midColor: '#ddd',
maxColor: '#0d0',
headerHeight: 15,
fontColor: 'black',
showScale: true});
}

NA

unread,
Jun 10, 2011, 8:27:51 AM6/10/11
to Google Visualization API
Is it perhaps using the average value of the 4th column, rather than
the sum? Can anyone clarify? Sorry if I'm missing something obvious
here.

thanks,


NA

unread,
Jun 10, 2011, 2:56:18 PM6/10/11
to Google Visualization API
Anyone? Even if I offered a beer for helpful advice?

Tayeb Karim

unread,
Jun 12, 2011, 1:45:44 PM6/12/11
to google-visua...@googlegroups.com

It is indeed using the average value. Perhaps we can make it an option to use max(childrens value) or sum(childrens value) instead in a future release.

> --
> You received this message because you are subscribed to the Google Groups "Google Visualization API" group.
> To post to this group, send email to google-visua...@googlegroups.com.
> To unsubscribe from this group, send email to google-visualizati...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/google-visualization-api?hl=en.
>

NA

unread,
Jun 12, 2011, 10:17:43 PM6/12/11
to Google Visualization API
Excellent - thanks for clarifying that. Letting it use the same
aggregation function approach that the DataTables use for aggregation
would be great, as that would offer the most flexibility. I can see
myself wanting to represent things such as the variance or even skew
of the data sets at some point in the future, so being able to define
my own aggregation function is always handy.

Also, the beer is yours to claim! If you're in the NYC area, drop me
a line.

thanks,



On Jun 12, 1:45 pm, Tayeb Karim <t...@google.com> wrote:
> It is indeed using the average value. Perhaps we can make it an option to
> use max(childrens value) or sum(childrens value) instead in a future
> release.
> On Jun 10, 2011 8:27 AM, "NA" <nabeel.a...@gmail.com> wrote:> Is it perhaps using the average value of the 4th column, rather than

d d

unread,
Jun 14, 2011, 3:00:36 PM6/14/11
to google-visua...@googlegroups.com
hi

2011/6/13 NA <nabee...@gmail.com>
Reply all
Reply to author
Forward
0 new messages