GithubHelp home page GithubHelp logo

Visual graph element about dannet HOT 10 CLOSED

kuhumcst avatar kuhumcst commented on June 18, 2024
Visual graph element

from dannet.

Comments (10)

simongray avatar simongray commented on June 18, 2024

https://mermaid-js.github.io/mermaid/#/./flowchart?id=flowcharts-basic-syntax

from dannet.

simongray avatar simongray commented on June 18, 2024

Having tried out vis.js in the form of react-graph-vis I didn't find it suitable for the following reasons:

  1. The supported layouts didn't work well for the data we have.
  2. There was seemingly no way to direct edge labels along the edges rather than on top of them.
  3. There was seemingly no way to group nodes.
  4. I found it relatively difficult to configure.

For this reason I have moved on to cytoscape.js packaged as /react-cytoscapejs. This solution fixes 1., 2., and 3. (using the "concentric" layout). It also feels easier to configure too, although I haven't fully configured it yet.

At this point I should probably also make a note about react-flow which on the surface seems like a well-documented, well-supported solution—and also something which could be used to edit graphs with at some point! However, I think react-flow is more suited to very small graphs with a clear "flow", rather than the type of graphs we must support, i.e. a single central node with a handful to several hundred outgoing connections.

from dannet.

simongray avatar simongray commented on June 18, 2024

While trying out Cytoscape.js I did found it to be an improvement over vis.js. However, it still has some major issues that at least require loading and configuring various extensions which may or may not solve these issues. The concentric layout is definitely preferable out of all of the layouts I have tried (including several custom ones), but I cannot configure the following:

  • edge label backgrounds (they get smushed when appearing on top of other things)
  • a minimum edge length (for small graphs, the edges are too short compared to the labels)
    • ... while there is seemingly no way to configure this, it may be possible to create a heuristic which adds minimumNodeDistance based on the amount of edges coming from the subject.
  • expanding/collapsing compound node groups. I tried loading an extension for this, but couldn't get it to display anything different. I think the issue was that it required significant configuration.

Some illustrations:

Working well (cykel)

Skærmbillede 2022-05-16 kl  15 56 56

Too close (lexikalt begreb)

Skærmbillede 2022-05-16 kl  15 57 12

Too far (ord)

Skærmbillede 2022-05-16 kl  15 57 32


Based on these issue I have decided to try out a third method: D3's radial tidy tree layout. I am currently unsure how to best use D3 from Rum. Some reading:

One thing that will not possible using a dendogram are self-referential relations. However, it should still be possible to include many-to-one relations as all of relations are from the same subject, so the objects can simply be duplicated many times over in the resulting tree.

from dannet.

simongray avatar simongray commented on June 18, 2024

Collapsible example: https://codepen.io/fernoftheandes/pen/kyQRNe

from dannet.

simongray avatar simongray commented on June 18, 2024

Having serious issues implementing the D3 radial tree for several reasons:

  • The collapsible example is using an old version of D3 which I don't want to use, so it needs to be rewritten
  • The observable version is hard to get clean source code for (or my JS foo is not enough)
  • The amount of JS to translate to CLJS is quite tiring. I tried mixing with pure JS code, but ran into the issues described in the bullets above.

Now I just discovered that there is actually a radial tree layout in vega too, which seems to look very similar—perhaps even better—and it seems much more compatible with my needs. I will go investigate.

I think I will attempt the React interop to begin with.

from dannet.

simongray avatar simongray commented on June 18, 2024

Vega attempt being tracked in: https://github.com/kuhumcst/DanNet/tree/feature/31d-vega

from dannet.

simongray avatar simongray commented on June 18, 2024

More inspiration: https://vega.github.io/vega/examples/tree-layout/

from dannet.

simongray avatar simongray commented on June 18, 2024

https://openbase.com/categories/js/best-react-graph-libraries

from dannet.

simongray avatar simongray commented on June 18, 2024

This looks interesting: https://unovis.dev/gallery

Perhaps an alternative to a graph could be the expanded sankey?

from dannet.

simongray avatar simongray commented on June 18, 2024

Some very interesting force graphs here: https://github.com/vasturiano/react-force-graph

I might also take a look at this one again: https://www.npmjs.com/package/react-d3-tree

from dannet.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.