0

I am struggling to make @swimlane/ngx-graph work for my project. I've invested a lot of work into getting it to this point, but as soon as I've tried to get the library to draw the edges between nodes, it generates a whole mess of errors. I've made my own custom layout, and I've tried every layout that comes with the library. They don't all generate the same errors, but every single one generates many errors.

I've looked into the code of the ngx-graph library, and none of the layouts seem to be implemented the same way. They all have a run() function, and the similarities stop there. I've also noticed that some of the layouts reference properties of the Graph objects that are not in the interface. I've also struggled up to this point to get the API elements to do what they're supposed to do.

I'm considering switching my project to cytoscape, but of course, I'm hesitant to throw out all of the work I've done so far so adapt ngx-graph. Cytoscape does have a lot of cool features, and seems to have both a larger community and better documentation. I ran a test case through source-map-explorer, and to my surprise, it's not even really any larger to include once it's all packed up, since it has fewer dependencies.

I have some other hesitations about switching though. First off, cytoscape isn't native to Angular. There are a handful of wrapper libraries that implement some of the directives to handle the bindings, but none of them are so popular that the choice is obvious. I have no idea if I would be trudging into a quagmire just trying to get some basic interactivity to work the particular way I want it to for my application. It is especially critical that the node labels be editable in the graph itself, and bound to data that can process those label edits and redraw other labels or graph elements.

I'm feeling a bit disheartened and stuck, as I've really been pouring my heart and soul into this project for the last 5 months. If I could go back in time, I think I would probably tell myself to avoid ngx-graph, but now, with all the work I've built on top of it, I just don't know how to even decide what the next steps are. It feels like a time-sink trying to read through every line of code of this library to see what it is expecting of my custom layout, since I can't rely on the interfaces.

I don't even know what my question is really, but if anyone has any words of advice, I could use it.

John Lott
  • 49
  • 5
  • Voted to close as this is a Q&A site for specific debugging questions. However my 2 cents: tech choices can be painful and particularly in the JavaScript ecosystem you have to choose you dependencies carefully. A pure js library is going to be more reliable but potentially harder to adapt to Angular. Most graphical libraries won’t be native to Angular (or React or Vue etc.). If the heart of the application is network graphs and you find a good js library you like like cytoscape then Svelte might be a good fit since it doesn’t require wrappers to use. – Andrew Allen Aug 28 '23 at 17:11

0 Answers0