Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Graph.Read ignores subgraph in Wpf #376

Open
TihonchukArtyom89 opened this issue Sep 18, 2024 · 0 comments
Open

Graph.Read ignores subgraph in Wpf #376

TihonchukArtyom89 opened this issue Sep 18, 2024 · 0 comments

Comments

@TihonchukArtyom89
Copy link

TihonchukArtyom89 commented Sep 18, 2024

Hi! I am create a graph add nodes and edges, and put some nodes in a subgraph. Then I am write this graph to *.msagl file and open with Graph.Read from this file and bind it to DockPanel. It display graph with all nodes and edges, but without subgraph.
Code:

      GraphViewer graphViewer = new GraphViewer();
      Graph graph = new();
      graphViewer.BindToPanel(graphViewerPanel);
      var a =graph.AddNode("A");
      var b = graph.AddNode("B");
      var c = graph.AddNode("C");
      var d = graph.AddNode("D");
      var f = graph.AddNode("F");
      b.Attr.Shape = Shape.Hexagon;
      var ab = graph.AddEdge(a.Id, b.Id);
      var fc = graph.AddEdge(f.Id, c.Id);
      var da = graph.AddEdge(d.Id, a.Id);
      var fa = graph.AddEdge(a.Id, f.Id);
      var s = new Subgraph("sub_Id");
      s.Attr.Color = Microsoft.Msagl.Drawing.Color.Red;
      s.Attr.FillColor = Microsoft.Msagl.Drawing.Color.Green;
      s.Attr.Shape = Shape.Box;
      s.Label.FontColor=Microsoft.Msagl.Drawing.Color.Black;
      s.Label.Text = "text subgraph";
      s.AddNode(a);
      s.AddNode(d);
      s.AddNode(f);
      graph.RootSubgraph.AddSubgraph(s);
      graph.Write("test_graph_with_subgraph.msagl");
      graph = Graph.Read("test_graph_with_subgraph.msagl");
      graphViewer.Graph = graph;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant