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

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

Open
XinyeYang opened this issue Apr 17, 2023 · 1 comment · May be fixed by #342
Open

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

XinyeYang opened this issue Apr 17, 2023 · 1 comment · May be fixed by #342

Comments

@XinyeYang
Copy link

XinyeYang commented Apr 17, 2023

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).

@thebestnom
Copy link
Collaborator

You are correct, I didn't update network config on reinit!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants