Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic same canvas for loading and creating the diagram (Read 2293 times)
liza
Full Member
***
Offline


I Love MindFusion!

Posts: 132
Joined: Apr 25th, 2019
same canvas for loading and creating the diagram
May 14th, 2019 at 3:57am
Print Post  
This time from where I referenced the code, @Html.DiagramView is used for creating diagram now my question is can we use the same for loading our diagram from database also?. This time I am using other canvas for loading diagram from the database.
  
Back to top
AIM  
IP Logged
 
Lyubo
God Member
*****
Offline


MindFusion team

Posts: 511
Joined: Jun 17th, 2010
Re: same canvas for loading and creating the diagram
Reply #1 - May 14th, 2019 at 6:15am
Print Post  
Hi,

What do you mean by "other canvas"? Do you mean on the server-side? You can store your diagram data as a string or JSON then use either Diagram.LoadFromString or DiagramView.LoadFromJson to load it from the database.
Code
Select All
DiagramView view = DiagramView.FromRequest("diagramView1", Request);
view.Diagram.LoadFromString(myDatabaseStringValue);
ViewBag.DiagramView = view; 


Code (HTML)
Select All
<div style="position: absolute; left: 0px; top: 0px; bottom: 0px; right: 0px">
    @Html.DiagramView(((DiagramView)ViewBag.DiagramView), new { style = "width:100%;height:100%;" })
</div> 



Check the Network and Flowchart samples, provided with the MvcDiagram package. They illustrate different ways to save/load the diagram from file.

Regards,
Lyubo
  
Back to top
 
IP Logged
 
liza
Full Member
***
Offline


I Love MindFusion!

Posts: 132
Joined: Apr 25th, 2019
Re: same canvas for loading and creating the diagram
Reply #2 - May 14th, 2019 at 8:06am
Print Post  
Can I open my diagram in edited form. and after updating diagram(updating text, deleting node, deleting link, adding other link mong other node), it should get saved and again load eith the updated data.
  
Back to top
AIM  
IP Logged
 
liza
Full Member
***
Offline


I Love MindFusion!

Posts: 132
Joined: Apr 25th, 2019
Re: same canvas for loading and creating the diagram
Reply #3 - May 14th, 2019 at 11:04am
Print Post  
Lyubo wrote on May 14th, 2019 at 6:15am:
Hi,

What do you mean by "other canvas"? Do you mean on the server-side? You can store your diagram data as a string or JSON then use either Diagram.LoadFromString or DiagramView.LoadFromJson to load it from the database.
Code
Select All
DiagramView view = DiagramView.FromRequest("diagramView1", Request);
view.Diagram.LoadFromString(myDatabaseStringValue);
ViewBag.DiagramView = view; 


Code (HTML)
Select All
<div style="position: absolute; left: 0px; top: 0px; bottom: 0px; right: 0px">
    @Html.DiagramView(((DiagramView)ViewBag.DiagramView), new { style = "width:100%;height:100%;" })
</div> 



Check the Network and Flowchart samples, provided with the MvcDiagram package. They illustrate different ways to save/load the diagram from file.

Regards,
Lyubo




please elaborate it more. I am not clear with this.
  
Back to top
AIM  
IP Logged
 
Lyubo
God Member
*****
Offline


MindFusion team

Posts: 511
Joined: Jun 17th, 2010
Re: same canvas for loading and creating the diagram
Reply #4 - May 14th, 2019 at 11:24am
Print Post  
Hi,

This code shows how you can load the diagram from string (for example retrieved from database) on the server-side and associate the view with the canvas on the client-side.

For more code examples like this you can refer to the online documentation and tutorials here: https://www.mindfusion.eu/onlinehelp/mvcdiagram/index.htm?CC_Tutorial_1__Getting... and sample applications provided with the MvcDiagram package.

Regards,
Lyubo
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint