Saturday, April 26, 2008

Tree chart for Flex

Nancy had asked for a sample on TreeChart . Here is a quick component I built for
Nancy . Ofcourse you can customise colours .. Sorrry I think my colour combinations are bad

You can download the source here
Usage :
1> Tree chart takes Hierarchical data as input .
2> Every node should have Name(Level as used in example[ It gets displayed in the chart] ) and value ( per in the example [ its the percentage]) and color ( the color of the area)
3> labelName should be mapped to Name and perName should be mapped to value

Look at the sample named testChart from the downloaded source .
Thank You Nancy for bringing up a good requirement :)


Nancy said...

Really amazing, thanks a ton for showing that example. I have another question for you.

I'm back, stumped bad and looking for some advice if you have a little time:>

ok, I can't transform a groupingCollection into some sort of Hierarchical data that I can edit. What I'd like to do is pass an advanced data grid a hierarchical data structure with no leaf nodes. I tried creating a groupingCollection from flat data, passing that to a new HierarchicalData instance, but when I look at the data it looks flat and I can't traverse it like I would normally traverse a tree.

var sBs:HierarchicalData = new HierarchicalData(groupingCollP);
var sTs:HierarchicalCollectionView = new HierarchicalCollectionView(sBs);

I also tried just using the grouping collection straight, which when looked at through the debugger is hierarchical. But... when I traverse each node I can only see the children properties, and have to way to add or remove a node which I would then pass back to the adg.

var root:Object = groupingCollP.getRoot();

I'm also trying stuff like

myXML = new XML(groupingCollP)

Man, I can't get it working. So my overall question is does somebody know how I can group flat data using a GroupingCollection and then traverse that collection adding / deleting / modifying nodes as I go. I'm not looking for the traversal algorithm, I have that. I just need to know how to get the data in the correct format.

Thanks a million times a billion for even reading this.

Satish T J said...

Hi nancy .. my example does uses a Hierarchical data ..
I suggest you catch me up online ..For easier interactions.
My gmail id is

Satish T J said...

It would be good if u can pass on a sample file ...

Diego said...

Hi Satish,

I got here, looking for a solution similar to nancy's.

I'd like to have this working in an AdvancedDataGrid.

Did you get that to work?

Thanks in advance,

srikanth602 said...

Can anybody let me know it you are able to get the list or collection of grouped data from advanced data grid . I am trying to bind this data to piechart . Any suggestions or code would be so much grateful