how to lay out groups in its own box,API?

Dec 18, 2012 at 2:23 PM

Hi, I'm using NodeXL library in C# windows form, I want to layout out each of the graph's in its own box and sort the boxes by group size, I Wrote some code like that:

nodexl.Layout.LayoutStyle = Smrf.NodeXL.Layouts.LayoutStyle.UseGroups;
nodexl.Graph.SetValue(ReservedMetadataKeys.GroupInfo, groupInfo);
nodexl.Layout = new Smrf.NodeXL.Layouts.HarelKorenFastMultiscaleLayout();
nodexl.DrawGraph(true);

I know it lacks some code, but I can't find any example code form .chm file.so,can you help me?

Thanks!

Dec 18, 2012 at 6:04 PM
Edited Dec 18, 2012 at 6:04 PM

Doug:

There is sample code for laying out each group in its own box in the "LayoutBase.LayoutStyle Property" topic in the NodeXLApi.chm help file.

In the code you posted, you are setting the LayoutStyle property on a Layout object and then promptly discarding that object by replacing it with another.  The correct order looks like this:

nodexl.Graph.SetValue(ReservedMetadataKeys.GroupInfo, groupInfo);
nodexl.Layout = new Smrf.NodeXL.Layouts.HarelKorenFastMultiscaleLayout();
nodexl.Layout.LayoutStyle = Smrf.NodeXL.Layouts.LayoutStyle.UseGroups;
nodexl.DrawGraph(true);

-- Tony

Dec 19, 2012 at 4:56 AM

It works :) :) :), thanks a lot!