From 51d2c21b010fca21668d0d471aeb4af1709a0ec4 Mon Sep 17 00:00:00 2001 From: y0083088 <j.rode@tu-bs.de> Date: Wed, 16 Jun 2021 22:17:07 +0200 Subject: [PATCH] dynamic canvas size via getWidth(); --- graph.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/graph.js b/graph.js index d5f7972..b07e756 100644 --- a/graph.js +++ b/graph.js @@ -25,7 +25,7 @@ async function loadGraph() { .onLinkHover(linkHover) .linkColor(linkColor) .linkOpacity(0.8) - .onEngineTick(loadComponents).width(800); + .onEngineTick(loadComponents).width(getWidth()); } @@ -40,6 +40,10 @@ function loadComponents() { } } +function getWidth() { + return document.getElementById('3d-graph').parentElement.offsetWidth; +} + function mapEdgeColors() { const linkClasses = getLinkClasses() for (let i = 0; i < linkClasses.length; i++) { -- GitLab