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

Implement Automatic Zoom-In After Displaying Query Results in Graph #3

Open
leon-k-martin opened this issue Aug 21, 2024 · 0 comments
Assignees
Labels
enhancement New feature or request

Comments

@leon-k-martin
Copy link
Collaborator

leon-k-martin commented Aug 21, 2024

Currently, after displaying query results in the graph, the view does not automatically adjust, potentially requiring manual zooming or panning to see the results clearly. This enhancement aims to implement an automatic zoom-in feature, ensuring that the results are immediately visible and centered within the graph view.

The following might work:

document.addEventListener("DOMContentLoaded", function() {
  const graphContainer = document.getElementById('graph-container');
  const graph = document.getElementById('3d-graph');
  const Graph = ForceGraph3D()(graph)
     // other graph attributes
    .width(graphContainer.clientWidth)
    .height(graphContainer.clientHeight)
    .cameraPosition({ z: 900 });

  // Optional: Add window resize listener to adjust graph size dynamically
  window.addEventListener('resize', () => {
    Graph.width(graphContainer.clientWidth).height(graphContainer.clientHeight);
  });

  // Initial resize to fit the container
  Graph.width(graphContainer.clientWidth).height(graphContainer.clientHeight);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants