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

Node labels cause extreme node sizes, and can't use ellipses on node labels #339

Open
chayduk-deloitte opened this issue Apr 20, 2023 · 1 comment

Comments

@chayduk-deloitte
Copy link

chayduk-deloitte commented Apr 20, 2023

Expected Behavior (Mandatory)

Should be able to prevent node size from exceeding a certain point. Node labels should be cut at a certain point and ended with an ellipsis (...)

Actual Behavior (Mandatory)

Scaling with regards to labels has no noticeable effect on node size. Long node labels completely warp the shape of the graph.

image

How to Reproduce the Problem

Below are the config options used for the graph. The scaling values are set to extreme levels for now to see if they have any effect on the graph.

export const visOptions: VisOptions = {
    edges: {
        arrows: {
            to: {
                enabled: directed,
                type: "arrow",
            },
        },
    },
    nodes: {
        shape: "circle",
        widthConstraint: 90,
        scaling: {
            max: 1,
            label: {
                enabled: true,
                max: 0,
                maxVisible: 0,
              }
        },
    },
    physics: {
        forceAtlas2Based: {
            gravitationalConstant: -26,
            centralGravity: 0.005,
            springLength: 230,
            springConstant: 0.18,
        },
        maxVelocity: 146,
        solver: "forceAtlas2Based",
        timestep: 0.35,
        stabilization: { iterations: 150 },
    },
};
@chayduk-deloitte chayduk-deloitte changed the title Can't use ellipses on node labels Node labels cause extreme node sizes, and can't use ellipses on node labels Apr 20, 2023
@Ricardo-M-Tian
Copy link

Ricardo-M-Tian commented Aug 16, 2024

   H1: {
            label: "name",
            size: "100",
            // group: "community",
            [NeoVis.NEOVIS_ADVANCED_CONFIG]: {
              function: {
                label: (node) => {
                  if (node.properties.name.length >= 5) {
                    return node.properties.name.substr(0, 5) + "..."; // 显示前5个字符加省略号
                  } else {
                    return node.properties.name; // 显示完整名称
                  }
                },
              },
            },
          },

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

No branches or pull requests

2 participants