Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Diagram - Load from Json (Read 4139 times)
Ghaith
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 21
Joined: Apr 7th, 2017
Diagram - Load from Json
Nov 7th, 2017 at 5:27pm
Print Post  
Dear,

In my application, I am using

this.diagramView.LoadFromJson(json_value);

and it is working fine, BUT when it is a very big diagram (Json length=5,000,000 char) , it is just crashing.


"Exception thrown: 'System.ArgumentException' in System.Web.Extensions.dll

Additional information: Erreur lors de la sérialisation ou de la désérialisation à l'aide de JSON JavaScriptSerializer. La longueur de la chaîne dépasse la valeur définie dans la propriété maxJsonLength."


is it possible to divide loading the nodes?
or any other solution
  
Back to top
 
IP Logged
 
Slavcho
YaBB Moderator
*****
Online


tech.support

Posts: 3147
Joined: Oct 19th, 2005
Re: Diagram - Load from Json
Reply #1 - Nov 8th, 2017 at 8:38am
Print Post  
You could load your data over web service and build diagram from it on client side. That should transfer far fewer bytes than full serialized diagram, and also shows the diagram faster if you transfer in several chunks and add to the diagram asynchronously. For example see OrgBrowser sample project - yours could do something similar, but request more nodes from a timer event handler instead of click event. Otherwise try setting larger maxJsonLength in web.config - that's an ASP.NET setting.

Regards,
Slavcho
  
Back to top
 
IP Logged
 
Ali Raza
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 1
Joined: Nov 20th, 2017
Re: Diagram - Load from Json
Reply #2 - Nov 20th, 2017 at 8:01pm
Print Post  
Dear Slavcho,
How can we request more nodes from a timer event handler instead of click event(+/-)?
  
Back to top
 
IP Logged
 
Slavcho
YaBB Moderator
*****
Online


tech.support

Posts: 3147
Joined: Oct 19th, 2005
Re: Diagram - Load from Json
Reply #3 - Nov 21st, 2017 at 12:16pm
Print Post  
Hi,

Instead of the nodeExpanded event handler shown in that example, run similar code from a setInterval handler. If your diagrams are trees as in the example, the web service could do something similar - return children of specified parent, and the client side adding a node's children on each response.

If it's an arbitrary graph, you could represent the graphs as adjacency list and transfer parts of the list, adding links and nodes with each response. E.g. your storage / database might look like linkId / sourceId / destId / texts / etc:

1: 1 -> 2
2: 1 -> 3
3: 2 -> 4
4: 3 -> 4
...

and you transfer only some rows of the full list. In the response handler you only create links between the nodes if nodes with specified IDs already exist, or otherwise also create nodes.

Regards,
Slavcho
  
Back to top
 
IP Logged
 
Slavcho
YaBB Moderator
*****
Online


tech.support

Posts: 3147
Joined: Oct 19th, 2005
Re: Diagram - Load from Json
Reply #4 - Jan 4th, 2018 at 10:05am
Print Post  
Now you can also set Json serializers' MaxJsonLength and RecursionLimit properties through DiagramView with this version - https://mindfusion.eu/Forum/YaBB.pl?num=1515057882

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