Is it possible to increase the height of a particular link in the organization chart?
Say, I have an Employeee tree with 3 employees
1 Parent employee and 2 sub employees
1st sub employees that belongs to grade 1 should be of link path of height 10, and Link path of sub employees in grade 2 should be 20;
Reposted from Northwoods Software
I m posting the code, Please let me know whether I am in the right path
<northwoods:Diagram x:Name=“OrganizationChartControl” Grid.Row=“1” TemplateApplied=“OrganizationChartControl_TemplateApplied”
NodeTemplate=“{StaticResource NodeTemplate}” ModelReplaced=“OrganizationChartControl_ModelReplaced”>
northwoods:Diagram.LinkTemplate
<Path StrokeDashArray=“{Binding Converter={StaticResource DiagramLinkConverter}}” northwoods:LinkPanel.IsLinkShape=“True” Stroke=“Black”
StrokeThickness=“3” Stretch=“Fill”>
northwoods:Link.Route
<northwoods:Route Routing=“Normal”/>
</northwoods:Link.Route>
</northwoods:Diagram.LinkTemplate>
northwoods:Diagram.Layout
<nortwoodsLayout:TreeLayout Angle=“90”/>
</northwoods:Diagram.Layout>
</northwoods:Diagram>
As I’m interpreting your requirement, you just want to position some nodes a bit lower than other nodes in each set of tree children, right?
I’ve modified TreeLayout in the FamilyTree sample so that it thinks nodes representing males are taller than they actually are, and so that it positions them a bit lower than female nodes with the same parent.
[code] public class CustomTreeLayout : TreeLayout {
protected override void InitializeTreeVertexValues(TreeVertex v) {
base.InitializeTreeVertexValues(v);
PersonNode person = v.Node.Data as PersonNode;
if (person != null && person.Gender == “M”) {
// preallocate more vertical space for each male person
Rect b = v.Bounds;
Point f = v.Focus;
b.Height += 10;
f.Y += 10;
v.Bounds = b;
v.Focus = f;
}
}
protected override void LayoutNodes() {
foreach (TreeVertex v in this.Network.Vertexes) {
Node node = v.Node;
if (node != null) {
Point pos = v.Position;
PersonNode person = node.Data as PersonNode;
if (person != null && person.Gender == "M") {
// shift each node down
pos.Y += 10;
}
node.Move(pos, true);
}
}
foreach (TreeVertex v in this.Network.Vertexes) {
LayoutComments(v);
}
}
}[/code]
Usage:
<go:Diagram . . .>
<go:Diagram.Layout>
<local:CustomTreeLayout . . . />
</go:Diagram.Layout>
</go:Diagram>
Looking at the FamilyTree sample again, I see we ought to change the name of the PersonNode class, to avoid potential confusion. It’s actually a data class, not a Node class.