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

how to set init scale #124

Open
oaoxd0314 opened this issue Sep 29, 2021 · 2 comments
Open

how to set init scale #124

oaoxd0314 opened this issue Sep 29, 2021 · 2 comments

Comments

@oaoxd0314
Copy link

Hi ! I want to resize chart, because it's too small
image

and i found in doc moveTo & once can help me set scale in the beginning

but i can't use that kind function in event ,

const events = {
    selectNode: function (params) {
      // console.log("select");
      console.log(params);
    },
    once: function () {
      console.log("once"); // not working
    },
    moveTo: function () {
      console.log("it's happening"); // not working
    },
  };

is there any better way to help me resize chart in the first time or use once and moveTo plz

@FengHuangDong
Copy link

Has any solution?

@SageRalph
Copy link

The events you can use are listed here:
https://visjs.github.io/vis-network/docs/network/#Events

If you want to call functions on the network object, you can access it using the component's state like this:

const [network, setNetwork] = useState({})

const events = {
  stabilized: function () {
    network.fit()
  },
}

return (
  <Graph
    graph={graph}
    options={options}
    events={events}
    getNetwork={setNetwork}
  />
)

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

3 participants