Skip to content

Commit

Permalink
Adjust Sample
Browse files Browse the repository at this point in the history
  • Loading branch information
Brains committed May 26, 2022
1 parent 3079700 commit 5e7b59a
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions GraphLayout/Samples/WpfApplicationSample/WpfApplicationSample.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
Expand All @@ -8,8 +8,10 @@
using System.Windows.Controls;
using System.Windows.Controls.Primitives;
using System.Windows.Input;
using Microsoft.Msagl.Core.Geometry.Curves;
using Microsoft.Msagl.Core.Routing;
using Microsoft.Msagl.Drawing;
using Microsoft.Msagl.Layout.Layered;
using Microsoft.Msagl.WpfGraphControl;
using Microsoft.Win32;
using Color = Microsoft.Msagl.Drawing.Color;
Expand Down Expand Up @@ -295,8 +297,7 @@ void CreateAndLayoutAndDisplayGraph(object sender, ExecutedRoutedEventArgs ex) {


var subgraph = new Subgraph("subgraph1");
subgraph.Label.Text = "Outer Subgraph";
subgraph.Attr.ClusterLabelMargin = LabelPlacement.Bottom;
subgraph.Label.Text = "Outer";
graph.RootSubgraph.AddSubgraph(subgraph);
subgraph.AddNode(graph.FindNode("47"));
subgraph.AddNode(graph.FindNode("58"));
Expand All @@ -305,14 +306,21 @@ void CreateAndLayoutAndDisplayGraph(object sender, ExecutedRoutedEventArgs ex) {
subgraph2.Label.Text = "Inner";
subgraph2.Attr.Color = Color.Black;
subgraph2.Attr.FillColor = Color.Yellow;
subgraph2.Attr.ClusterLabelMargin = LabelPlacement.Left;
subgraph2.Attr.ClusterLabelMargin = LabelPlacement.Bottom;
subgraph2.AddNode(graph.FindNode("70"));
subgraph2.AddNode(graph.FindNode("71"));
subgraph.AddSubgraph(subgraph2);
graph.AddEdge("58", subgraph2.Id);

graph.Attr.LayerDirection = LayerDirection.LR;
//graph.LayoutAlgorithmSettings.EdgeRoutingSettings.EdgeRoutingMode = EdgeRoutingMode.Rectilinear;

var global = (SugiyamaLayoutSettings) graph.LayoutAlgorithmSettings;
var local = (SugiyamaLayoutSettings) global.Clone();
local.Transformation = PlaneTransformation.Rotation(-Math.PI / 2);
subgraph2.LayoutSettings = local; // for Collapsing\Expanding
global.ClusterSettings.Add(subgraph2, local);

graphViewer.Graph = graph;
}
catch (Exception e)
Expand Down

0 comments on commit 5e7b59a

Please sign in to comment.