private void GenerateGraph() { var logicCore = new LogicCoreExample() { Graph = ShowcaseHelper.GenerateDataGraph(3, false) }; var vList = logicCore.Graph.Vertices.ToList(); //add edges ShowcaseHelper.AddEdge(logicCore.Graph, vList[0], vList[1]); ShowcaseHelper.AddEdge(logicCore.Graph, vList[1], vList[0]); ShowcaseHelper.AddEdge(logicCore.Graph, vList[1], vList[2]); ShowcaseHelper.AddEdge(logicCore.Graph, vList[1], vList[2]); ShowcaseHelper.AddEdge(logicCore.Graph, vList[2], vList[1]); graphArea.LogicCore = logicCore; //set positions var posList = new Dictionary <DataVertex, Point>() { { vList[0], new Point(0, -150) }, { vList[1], new Point(300, 0) }, { vList[2], new Point(600, -150) }, }; //settings graphArea.LogicCore.EnableParallelEdges = true; graphArea.LogicCore.EdgeCurvingEnabled = true; graphArea.LogicCore.ParallelEdgeDistance = _edgeDistance; graphArea.LogicCore.DefaultEdgeRoutingAlgorithm = EdgeRoutingAlgorithmTypeEnum.SimpleER; //preload graph graphArea.PreloadGraph(posList); //behaviors graphArea.SetVerticesDrag(true, true); graphArea.ShowAllEdgesLabels(); graphArea.AlignAllEdgesLabels(); zoomControl.MaxZoom = 50; //manual edge corrections var eList = graphArea.EdgesList.Values.ToList(); eList[0].LabelVerticalOffset = 12; eList[1].LabelVerticalOffset = 12; eList[2].ShowLabel = false; eList[3].LabelVerticalOffset = 12; eList[4].LabelVerticalOffset = 12; //PS: to see how parallel edges logic works go to GraphArea::UpdateParallelEdgesData() method zoomControl.ZoomToFill(); }
private void GenerateGraph() { var logicCore = new LogicCoreExample { Graph = ShowcaseHelper.GenerateDataGraph(6, false) }; var vList = logicCore.Graph.Vertices.ToList(); //add edges ShowcaseHelper.AddEdge(logicCore.Graph, vList[0], vList[1], 3, 2); ShowcaseHelper.AddEdge(logicCore.Graph, vList[0], vList[2], 4, 2); ShowcaseHelper.AddEdge(logicCore.Graph, vList[1], vList[3], 3, 1); ShowcaseHelper.AddEdge(logicCore.Graph, vList[3], vList[5], 2, 3); ShowcaseHelper.AddEdge(logicCore.Graph, vList[2], vList[4], 4, 2); ShowcaseHelper.AddEdge(logicCore.Graph, vList[4], vList[5], 1, 4); ShowcaseHelper.AddEdge(logicCore.Graph, vList[5], vList[1], 1, 4); ShowcaseHelper.AddEdge(logicCore.Graph, vList[5], vList[2], 2, 3); graphArea.LogicCore = logicCore; //set positions var posList = new Dictionary <DataVertex, Point>() { { vList[0], new Point(0, 0) }, { vList[1], new Point(200, -200) }, { vList[2], new Point(200, 200) }, { vList[3], new Point(600, -300) }, { vList[4], new Point(600, 300) }, { vList[5], new Point(400, 0) }, }; graphArea.PreloadGraph(posList); //settings graphArea.SetVerticesDrag(true, true); zoomControl.ZoomToFill(); }