Configuring bundled edges and labels in C# project

Apr 24, 2013 at 9:30 PM
I am playing around with the C# code snippet from the documentation (see below). Is there an easy way to activate labels for the vertices and to set up bundled edges as you can easily do in the Excel UI? Thanks for your hints.
ILayout oLayout = new FruchtermanReingoldLayout() { Iterations=40 };
Rectangle orec = new Rectangle(0, 0, GraphWidth, GraphHeight);
LayoutContext oLayoutContext = new LayoutContext(orec);
oLayout.LayOutGraph(oGraph, oLayoutContext);
NodeXLVisual oNodeXLVisual = new NodeXLVisual() { };
GraphDrawingContext oGraphDrawingContext = new GraphDrawingContext(
                new System.Windows.Rect(0, 0, GraphWidth, GraphHeight), oLayout.Margin,
                System.Windows.Media.Color.FromRgb(255, 255, 255));
oNodeXLVisual.GraphDrawer.DrawGraph(oGraph, oGraphDrawingContext);
Apr 25, 2013 at 8:38 PM
NodeXL uses a dictionary of key/value pairs with reserved key names to set things such as vertex color, size, and labels. To set a vertex label, do this:
vertex.SetValue(ReservedMetadataKeys.PerVertexLabel, "This is the label.");
The complete set of reserved keys is documented in the "ReservedMetadataKeys Members" topic in the NodeXLApi.chm help file that ships with the NodeXL class libraries.

To bundle edges:
nodeXLControl.GraphDrawer.EdgeDrawer.CurveStyle = EdgeCurveStyle.CurveThroughIntermediatePoints;
You can then control the edge curvature using the NodeXLControl.EdgeBundlerStraightening property.

-- Tony
Apr 28, 2013 at 1:07 AM
Thanks, big help. Labeling is pretty easy, switching from a nodeXLVisual to a nodeXLControl more complex. Instead of that I used
NodeXLVisual.GraphDrawer.EdgeDrawer.CurveStyle = EdgeCurveStyle.Bezier;
which also looks nice.