Matt Kruse ha scritto:
>> Renato Formato schrieb:
>>> I wrote a jQuery plugin to show treemaps
>>> (http://en.wikipedia.org/wiki/Treemap) easily thanks to jQuery.
>>> Link: http://www.jquery.info/spip.php?article40
> 
> The documentation is pretty light, so it's hard to understand exactly what the
> table data structure needs to be and how to quickly implement a treemap. It
> would be nice to have some examples like "given this table, this is the
> result." 
Hi Matt,

It's not for nothing that I like to have feedback :)
You can give a look at the population demo to see the underlying table, 
just disable js and you'll see the table.

The table must not have a rigid structure, the options dataCell, 
labelCell and colorCell let you specify the number of the columns 
(counting from 0, which is the first column) in which these data can be 
found.

Taken from the doc:
To create a Treemap of dimensions 640x480 starting from the tables in 
the page, retrieving the descriptions from the 3rd column and the data 
from the 5th:

jQuery("table").treemap(640,480,{labelCell:2,dataCell,4});

> My first attempt to use it has failed on this line in normalizeValues:
> 
>    if(data[i][1].constructor==Array)
> 
> When feeding it a table like this:
> 
>    Name   Size(Number)   Value(Number)
> 
> My goal is to show distribution of stocks and their relative performance like 
> a
> financial Heat Map. The Size would be the size % of the total and Value would
> be the MTD% performance. Is this not the correct table layout?

As I've just said, The table layout is not so important, as long you set 
the right options.
I can't help, I need more informations. Could you provide a sample table 
to make some tests?

> 
> I would also suggest cleanly separating the Treemap logic from the jquery/html
> implementation. This way if I wanted to use your core logic for something
> entirely different and not jquery-ish or maybe using a different layout
> structure, I could still do so.

Oh, that would be a nice refactoring. I'll keep it in the todo list but 
as I wrote this plugin with jQuery in mind, I think it's not a priority.

By the way what kind of different layouts do you have in mind?

> 
> Thanks for the plugin, I'm sure I will find uses for it in the near future!

Great! Let us know when you'll do it.

Ciao
Renato


_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/

Reply via email to