Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The more nodes are added the more the custom svg rect gets stretched #494

Open
onra2 opened this issue Feb 20, 2023 · 3 comments
Open

The more nodes are added the more the custom svg rect gets stretched #494

onra2 opened this issue Feb 20, 2023 · 3 comments
Labels

Comments

@onra2
Copy link

onra2 commented Feb 20, 2023

Describe the bug
Making a graph with custom svg template (copied from the ngx graph doc) with +- 15 nodes works fine. Making the same graph but with 30+ nodes breaks it, the more nodes you add the more it gets stretched. Also i found that when calling fitGraph() it stretches the rectangle.

To Reproduce
Steps to reproduce the behavior:

  1. Create a graph with custom svg as show in the documentation
    `
<ng-template #nodeTemplate let-node>
  <svg:g class="node" (click)="click(node)">
    <svg:rect [attr.width]="node.dimension.width" [attr.height]="node.dimension.height"
      [attr.fill]="node.data.color" />
    <svg:text alignment-baseline="central" [attr.x]="10" [attr.y]="node.dimension.height / 2">{{node.label}}
    </svg:text>
  </svg:g>
</ng-template>

<ng-template #linkTemplate let-link>
  <svg:g class="edge">
    <svg:path class="line" stroke-width="2" marker-end="url(#arrow)">
    </svg:path>
    <svg:text class="edge-label" text-anchor="middle">
      <textPath style="fill: #666;" [attr.href]="'#' + link.id" startOffset="60%">
        {{link.label}}
      </textPath>
    </svg:text>
  </svg:g>
</ng-template>
` 2. Make the same graph as shown in the screenshots below 3. If you make a graph with 10 nodes it will be fine, make another with a lot more nodes 4. See error

Expected behavior
i expect the rectangle to not change size based on the number of nodes.

Screenshots
20 Nodes correct:
https://i.imgur.com/p7Kgdp4.png

30+ Nodes incorrect:
https://i.imgur.com/zy51dAw.png

ngx-graph version
8.0.3

@onra2 onra2 added the bug label Feb 20, 2023
@bonnm
Copy link

bonnm commented May 15, 2023

Same with ngx 8.0.2
But strange: The bug does not appear under Firefox, there everything looks good. But under Chrome-based Edge the rectangles are also broken...

@UPCN-Nestor
Copy link

Same here under Chrome

@UPCN-Nestor
Copy link

Also, with many nodes/edges, custom template edges disappear

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants