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

Only one custom edge rendered. #417

Open
brn9966b opened this issue Aug 31, 2021 · 11 comments
Open

Only one custom edge rendered. #417

brn9966b opened this issue Aug 31, 2021 · 11 comments
Labels

Comments

@brn9966b
Copy link

Hello,
I tried to add arrows on my graph and only one is rendered

Here is the code for my graph

<ngx-graph [view]="[1700,650]" class="w-100 chart-container" [enableZoom]="false" [draggingEnabled]="false"
    [showMiniMap]="true" [links]="links" [nodes]="nodes" [clusters]="clusters" layout="dagreCluster"
    (select)="onNodeSelect($event)" [update$]="update$">
    
    <ng-template #clusterTemplate let-cluster>
        <svg:g class="node cluster">
            <svg:rect rx="5" ry="5" [attr.width]="cluster.dimension.width" [attr.height]="cluster.dimension.height"
                [attr.fill]="cluster.data.color" />
        </svg:g>
    </ng-template>

    <ng-template #nodeTemplate let-node>
        <svg:g class="node">
            <svg:rect [attr.width]="node.dimension.width" [attr.height]="node.dimension.height *1.25"
                [attr.fill]="node.data.color" />
            <svg:text alignment-baseline="central" [attr.x]="10" [attr.y]="node.dimension.height / 2">
                {{node.numero}}
            </svg:text>
            <svg:text alignment-baseline="central" [attr.x]="10" [attr.y]="node.dimension.height">
                {{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
              class="text-path"
              [attr.href]="'#' + link.id"
              [style.dominant-baseline]="link.dominantBaseline"
              startOffset="50%"
            >
              {{link.label}}
            </textPath>
          </svg:text>
        </svg:g>
      </ng-template>

      <ng-template #defsTemplate>
        <svg:marker id="arrow" viewBox="0 -5 10 10" refX="8" refY="0" markerWidth="4" markerHeight="4" orient="auto">
          <svg:path d="M0,-5L10,0L0,5" class="arrow-head" />
        </svg:marker>
      </ng-template>
</ngx-graph>

Screenshots

image

ngx-graph version
7.2.0

Additional context
Angular 10 & Bootstrap 5 used

Maybe I'm not doing it right, but I copied the example from the example.

Thanks for your time.

@brn9966b brn9966b added the bug label Aug 31, 2021
@jbj2021
Copy link

jbj2021 commented Sep 23, 2021

I had the same issue. I had numbers as the ids for links. I guess it was clashing with the node ids. I changed the link ids as alpha numeric and it started working. Hope it helps

@subhramira
Copy link

Same issue with me with ngx-graph:8.0.3 & angular:14.0.0.Even if after changing the link id to alphanumeric only one link is rendered

@rawsonhunter79
Copy link

Same issue with me with ngx-graph:8.0.3 & angular:14.0.0.Even if after changing the link id to alphanumeric only one link is rendered

I am also seeing this issue with ng-graph:8.0.3 & angular:14.1.0. Changing link and node ids did not fix for me. Is there any other workaround for this?

@rawsonhunter79
Copy link

rawsonhunter79 commented Mar 8, 2023

Same issue with me with ngx-graph:8.0.3 & angular:14.0.0.Even if after changing the link id to alphanumeric only one link is rendered

This actually worked for me: #487 (comment)

@suryasyam61
Copy link

suryasyam61 commented Mar 17, 2023

I also faced the same problem,

when I uninstall @type/d3 in devDependencies and reinstalled now its working

@Pellys98
Copy link

Pellys98 commented Dec 7, 2023

I have the same issue and tried all the proposed solutions, it still doesn't work.

@KlrSur0
Copy link

KlrSur0 commented Jan 22, 2024

@Pellys98, it's the same for me. My project is with an angular 16 version. I always have the error. Have you found a solution?

@KlrSur0
Copy link

KlrSur0 commented Jan 22, 2024

🔥 After one day of looking at it, I've found a solution => install the v8.2.2 of @swimlane/ngx-graph.
You don't need to add the override.

@edangel1612
Copy link

en mi caso tengo angular 17 y me funciona tener la version 8.0.2 de ngx y de d3-selection la version 3.0.10

@Francesco-Borzi
Copy link

same issue here

@josmar131
Copy link

Same issue using the last version.

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

10 participants