Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Diagram Not Displaying (Read 3750 times)
dolfandon
Junior Member
**
Offline



Posts: 51
Location: Northern Virginia
Joined: Mar 12th, 2009
Diagram Not Displaying
Dec 19th, 2016 at 8:11pm
Print Post  
Just in case this matter which I don't think it should but I'm creating a view in an existing WebForms app. I have all the plumbing working but I can't get the diagram control to show on a view. I'm using the MVC control and I can get things to the view just fine but the diagram itself just doesn't show up. I'm using the boilerplate test code from the tutorial so I don't think it is that. Any help would be appreciated. Here's the view but it is pretty straight forward.

Oh, the diagram is there if I inspect the page with Firebug but it doesn't show. Do I need a render or something?

Code
Select All
@using MindFusion.Diagramming.Mvc
@using MindFusion.Diagramming;
@using System.Drawing;
@using SolidBrush = MindFusion.Drawing.SolidBrush;
@using LinearGradientBrush = MindFusion.Drawing.LinearGradientBrush;

@model NorthropGrumman.EPower.UI.Web.Admin.Areas.Admin.Models.ProcessDesignerModel

@{
    Layout = null;
}

<!DOCTYPE html>

<html>
<head>
    <meta name="viewport" content="width=device-width" />
    <title>@Model.PageTitle</title>
    <script src="~/Scripts/MindFusion.Diagramming.js"></script>
    <script>
        @{
            DiagramView view = new DiagramView("diagramView1");

            //Test Code
            Diagram diagram = view.Diagram;
            diagram.BackBrush = new SolidBrush(Color.AntiqueWhite);
            diagram.LinkHeadShape = ArrowHeads.Triangle;
            diagram.LinkHeadShapeSize = 3;

            DiagramStyle style = new DiagramStyle();
            style.FontFamily = "Verdana";
            style.Brush = new LinearGradientBrush(Color.LightBlue, Color.Blue, 90);
            style.Stroke = new SolidBrush(Color.Black);

            ShapeNode node1 = diagram.Factory.CreateShapeNode(new RectangleF(55, 10, 40, 15));
            node1.Shape = Shapes.Terminator;
            node1.Text = "Start";
            node1.Brush = new LinearGradientBrush(Color.Yellow, Color.Orange, 90);

            ShapeNode node2 = diagram.Factory.CreateShapeNode(new RectangleF(50, 40, 50, 20));
            node2.Text = "Receive order via e-mail";

            ShapeNode node3 = diagram.Factory.CreateShapeNode(new RectangleF(50, 70, 50, 20));
            node3.Text = "Copy and paste e-mail data into database";

            ShapeNode node4 = diagram.Factory.CreateShapeNode(new RectangleF(55, 100, 40, 40));
            node4.Shape = Shape.FromId("Decision");
            node4.Text = "Shipping involved?";
            node4.Brush = new LinearGradientBrush(Color.White, Color.Fuchsia, 90);

            ShapeNode node5 = diagram.Factory.CreateShapeNode(new RectangleF(100, 135, 50, 20));
            node5.Shape = Shape.FromId("Save");
            node5.Text = "Print invoice and UPS label";
            node5.Brush = new SolidBrush(Color.Chartreuse);

            ShapeNode node6 = diagram.Factory.CreateShapeNode(new RectangleF(100, 165, 50, 20));
            node6.Text = "Send e-mail to confirm shipping";
            diagram.Nodes.Add(node6);

            ShapeNode node7 = diagram.Factory.CreateShapeNode(new RectangleF(100, 195, 50, 20));
            node7.Text = "Assemble package and ship";

            ShapeNode node8 = diagram.Factory.CreateShapeNode(new RectangleF(55, 230, 40, 15));
            node8.Shape = Shapes.Terminator;
            node8.Text = "End";
            node8.Brush = new LinearGradientBrush(Color.Yellow, Color.Orange, 90);

            diagram.Factory.CreateDiagramLink(node1, node2);
            diagram.Factory.CreateDiagramLink(node2, node3);
            diagram.Factory.CreateDiagramLink(node3, node4);

            DiagramLink link4 = diagram.Factory.CreateDiagramLink(node4, node5);
            link4.Text = "Yes";

            diagram.Factory.CreateDiagramLink(node5, node6);
            diagram.Factory.CreateDiagramLink(node6, node7);
            diagram.Factory.CreateDiagramLink(node7, node8);

            DiagramLink link8 = diagram.Factory.CreateDiagramLink(node4, node8);
            link8.Text = "No";

            // End Test Code

            diagram.Style = style;
            ViewBag.DiagramView = view;
        }
    </script>
</head>
<body>
    <h2>@Model.PageHeader</h2>
    <div width="90%">
        @Html.DiagramView((DiagramView)ViewBag.DiagramView, new { style = "width:1000px; height:700px" })
    </div>
</body>
</html>
 

  
Back to top
 
IP Logged
 
Slavcho
YaBB Moderator
*****
Offline


tech.support

Posts: 3435
Joined: Oct 19th, 2005
Re: Diagram Not Displaying
Reply #1 - Dec 20th, 2016 at 12:02pm
Print Post  
Are there any errors shown in the console? If building large diagrams, try setting DiagramView.VirtualScroll = true to avoid problems with large canvas sizes.
  
Back to top
 
IP Logged
 
dolfandon
Junior Member
**
Offline



Posts: 51
Location: Northern Virginia
Joined: Mar 12th, 2009
Re: Diagram Not Displaying
Reply #2 - Dec 20th, 2016 at 2:58pm
Print Post  
I tried that but it didn't work but it did lead to the answer. There wasn't an error but I did notice that a JQuery call was failing and realized that project has on older version running. I set the JQuery version and it is now working.
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint