Coder Social home page Coder Social logo

Comments (7)

kouedelo avatar kouedelo commented on May 26, 2024 1
  1. The data we generated is a "graph" which has two sides; left and right side. Each side may have none to multiple nodes.
  2. Unfortunatley, the proposed solution wouldn't be usable for us since the data is not a tree.

from visualization.

GordonSmith avatar GordonSmith commented on May 26, 2024

I have looked into this and there is a relatively easy way to add additional forces to influence which side they end up on.
Questions:

  1. Is your data genuinely a "graph" or is it a "tree"?
  2. If it is a tree, would adapting https://raw.githack.com/hpcc-systems/Visualization/trunk/demos/gallery/gallery.html?./samples/tree/Dendrogram to allow left AND right branches be a better viz?

from visualization.

GordonSmith avatar GordonSmith commented on May 26, 2024

Note to self: https://github.com/d3/d3-force/blob/main/README.md#positioning

from visualization.

waterkey15 avatar waterkey15 commented on May 26, 2024

yes this positioning function is something that may be useful for us! @GordonSmith would you mind sending us a very simple example code where you position a node to a desired location? Maybe push node B to all the way right and push node A to all the way left? If you could update the code snippet below that would be super helpful for us.

import { Graph2 } from "@hpcc-js/graph";

const data = {
    vertices: [
        {id: 0,text: "A",categoryID: 0},
        {id: 1,text: "B",categoryID: 0},
        {id: 2,text: "C",categoryID: 1},
    ]
};
data.edges = [
    {id: 0,source: data.vertices[2],target: data.vertices[0]},
    {id: 1,source: data.vertices[2],target: data.vertices[1]}
];
new Graph2()
    .categories([
        {id:0,imageChar:"fa-user"},
        {id:1,imageChar:"fa-asterisk"}
    ])
    .data(data)
    .target("target")
    .layout("ForceDirected")
    .applyScaleOnLayout(true)
    .highlightSelectedPathToCentroid(true)
    .enableTooltipPointerEvents(false)
    .render()
    ;

from visualization.

waterkey15 avatar waterkey15 commented on May 26, 2024

hi @GordonSmith would it be possible for you to provide us a simple example using positioning logic you mentioned in your previous comment? Thank you very much!

from visualization.

GordonSmith avatar GordonSmith commented on May 26, 2024

My previous comments was referencing information needed to implement the feature - rather than it existing...

The following code is where the current force is initialised: https://github.com/hpcc-systems/Visualization/blob/trunk/packages/graph/src/graph2/layouts/forceDirected.ts#L43-L68

I think we would need 3 simulations - center, left and right and then filter the vertices appropriately into each of the 3 sims?

from visualization.

waterkey15 avatar waterkey15 commented on May 26, 2024

yes that sounds correct! please let me know if there are any updates or any code snippets that I can use! Thank you very much!
@GordonSmith

from visualization.

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.