Skip to content

Problems about neoViz.reinit(config) [physics] #338

@XinyeYang

Description

@XinyeYang

Expected Behavior (Mandatory)

I changed the physic theta property in config from 10 to 0.5, then call neoViz.reinit(config), the render speed should be slower and the graph should be more accurate.

Actual Behavior (Mandatory)

The behavior before and after changing the theta parameters is the same, without any changes.

How to Reproduce the Problem

config = {
    containerId: "viz",
    neo4j: {
        serverUrl: "bolt://localhost:7687",
        serverUser: "neo4j",
        serverPassword: "12345",
    },
    visConfig: {
        nodes: {
            shape: 'dot',
            size: 10
        },
        edges: {
            arrows: {
                to: { enabled: false }
            },
            selectionWidth: 3,
            color: {
                color: "#00ffff",
                highlight: "#bac295",
            },
        },
        physics: {
            barnesHut: {
                theta: 2,
                gravitationalConstant: -6000,
                centralGravity: 0.3,

                springLength: 10,
                springConstant: 0.04,
                damping: 0.8,
                avoidOverlap: 0.6
            },
            solver: "barnesHut",
            timestep: 0.15,
            minVelocity: 0.01
        },
    },
    labels: {
        NEW_DCYD: {
            // label: ["CWE_ID"],
            [NeoVis.NEOVIS_ADVANCED_CONFIG]: {
                static: {
                    color: {
                        border: "#ffffff",
                        background: "#ffffff",
                        highlight: {
                            border: "#ffffff",
                            background: "#000000"
                        }
                    },
                    shape: "dot",
                    size: 50,
                    borderWidth: "1",
                    font: {
                        "background": "none",
                        "strokeWidth": "0",
                        "size": 30,
                        "color": "#464646"
                    }
                },
                function: {
                    color: {
                        background: (node) => node.properties.CVE_ID ? "#bd6962" : node.properties.CWE_ID ? "#a4cbfa" : node.properties.PUBLISH_DATE ? "#f7ce46" : "#a4cb9d",
                    }, 
                    title: (node) => NeoVis.objectToTitleString(node, ["CVE_ID", "YEAR", "CWE_ID", "CAUSE", "LOCATION", "VERSION", "ATTACKER", "CONSEQUENCE", "OPERATION"])
                }
            }
        }
    },
    relationships: {
        CWE_NUMBER: {
            [NeoVis.NEOVIS_ADVANCED_CONFIG]: {
                static: {
                    label: "CWE NUMBER", 
                    color: "#ffffff",
                    font: {
                        "background": "none",
                        "strokeWidth": "0",
                        "size": edgeFontSize,
                        "color": "#f9dc73"
                    }
                }
            }
        },
        LOCATION: {
            [NeoVis.NEOVIS_ADVANCED_CONFIG]: {
                static: {
                    label: "LOCATION", 
                    color: "#ff0000",
                    font: {
                        "background": "none",
                        "strokeWidth": "0",
                        "size": edgeFontSize,
                        "color": "#437ce5"
                    }
                }
            }
        }
    },
    initialCypher: "MATCH (n:NEW_DCYD)-[r]->(m) WHERE n.YEAR >= '2022' RETURN *"
};
config.visConfig.physics.barnesHut.theta = 0.5;
neoViz.reinit(config);

Screenshots (where it's possibile)

It should look like the right picture when I call reinit(config).

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions