Store Items in Database

Oct 1, 2010 at 7:43 PM

Dear,

First of all, thank you for sharing this great library.

I really like it and it looks pretty nice with the samples.

 

But i want to hold the nodes and the edges in a database rather than in .graph file.

 

I tried to find the position where the file is parsed but it is a little bit complex.

I think the Parse() method in MyParser but I did not find the specific point.

 

Is something like this planned or could you please give me a hint how to reach this?

 

I am thinking of a simple collection of nodes and edges (which I get from the database) which will then be parsed and placed at the correct position.

 

 

Best regards,

Bullety

Coordinator
Oct 5, 2010 at 7:32 AM

You can create instance of DrawingGraph and use AddNode and AddEdge methods.

// Create instance of DrawingGraph
var graph = new DrawingGraph("Lable");

// Define your graph. This code can be based on information from DB
graph.AddEdge("A", "B");
graph.AddEdge("B", "C");
graph.AddEdge("A", "C");

// Make layout
var engine = new GraphVizLayoutBatch();
engine.Execute(graph);

Oct 5, 2010 at 12:48 PM

Dear bog1978,

 

Thank you for your solution, that works!

 

Best regards,

Bullety

Nov 5, 2010 at 3:57 AM

Here is a bug report on this topic:

If I replace some code in loadGraph to not load from Stream I run into a crash on line 32 in EdgeRouteJob.cs:

var srcPort = edge.Src.GetShapePort(points[1]);

DemoViewModel.cs:

        private void loadGraph(Stream stream)
        {
            // Create instance of DrawingGraph
            var graph = new DrawingGraph("Label");

            // Define your graph. This code can be based on information from DB
            graph.AddEdge("A", "B");
            graph.AddEdge("B", "C");
            graph.AddEdge("A", "C");

            var engine = new GraphVizLayoutBatch();
            engine.Execute(graph);
            Graph = graph;

            var s = new MemoryStream();
            Graph.WriteToFile(s);
            var data = s.ToArray();
            var str = Encoding.UTF8.GetString(data, 0, data.Length);
            GraphDefinition = str;
        }

-Jesper

Coordinator
Nov 8, 2010 at 7:37 AM
This discussion has been copied to a work item. Click here to go to the work item and continue the discussion.
Jul 18, 2011 at 5:47 AM

i keep dont unserstnd with this issue....anyone help me. i have same problem