question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

wrong link ends position after rendring from json (graph.fromJSON)

See original GitHub issue

Hello, I draw the diagram below: diag_beafore_serl I export the diagram using graph.toJSON() then I import it using graph.fromJSON(), the diagram was rendered as below: diag_after_serl

The link ends was changed. This is my paper config:

const paper = new joint.dia.Paper({
      el: $('#paper', el),
      width: PAPER.WIDTH,
      height: PAPER.HEIGHT,
      gridSize: 1,
      model: graph,
      cellViewNamespace: joint.shapes,
      drawGrid: true,
      interactive: true,
      linkPinning: false,
      defaultRouter: {
        name: 'manhattan',
        args: {
          perpendicular: true,
          step: 20
        }
      }
    });

Could anyone please help me out here ? Thanks.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:13 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
thoussemcommented, Apr 3, 2020

@kumilingus thank you very much it works

0reactions
kumilinguscommented, Apr 3, 2020

It’s probably because the paper is not in the DOM when it starts to render elements and links. Try to freeze the paper at initialization and unfreeze it when you are sure the paper is in the DOM.

const paper = new joint.dia.Paper({ frozen: true });
// later when paper is in the DOM
paper.unfreeze();
Read more comments on GitHub >

github_iconTop Results From Across the Web

Custom Links are not drawn on paper after redo or graph ...
Hello, I have a problem with my custom link regarding the recreation of it ... fromJSON(treeGraphJSON ) the links are visually missing.
Read more >
links not working as required when used with reparenting
I am not sure what is wrong and I am still new to joint js. Code: window.onload = function () { var graph...
Read more >
problem with fromJSON - Google Groups
I have encountered the following problem with using graph.fromJSON function. I think I am using the functions correctly according to whats described here:....
Read more >
Data From JSON | Working with Data - AnyChart Documentation
AnyChart js charting library supports several ways of setting data. This article quickly demonstrates main aspects of using JSON format in AnyChart component....
Read more >
JavaScript JSON Date Parsing and real Dates - Rick Strahl
JavaScript doesn't have a date literal, and for this reason JSON serializes dates as strings rather than real JavaScript dates.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found