From 181e5cfe101af18098d0e31136a2e24ac6882f93 Mon Sep 17 00:00:00 2001
From: jorgetutor <jorge.tutor@metadrop.net>
Date: Thu, 20 Feb 2025 11:55:42 +0100
Subject: [PATCH] Issue #3507987: Graph - adjust graph width

---
 js/entity-mesh.js | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/js/entity-mesh.js b/js/entity-mesh.js
index b3d486b..1f1b23c 100644
--- a/js/entity-mesh.js
+++ b/js/entity-mesh.js
@@ -40,7 +40,10 @@ function graphGenerate(data, settings) {
 
   // Init Graph:
   let graph = document.querySelector(selector);
-  let width = window.innerWidth - 100;
+  let graph_cstyle = window.getComputedStyle(graph);
+  let width = graph.clientWidth +
+    parseFloat(graph_cstyle.paddingLeft) +
+    parseFloat(graph_cstyle.paddingRight);
   let height = 450;
   if (settings.fullHeight) {
     height = window.innerHeight - 300;
@@ -53,7 +56,7 @@ function graphGenerate(data, settings) {
   const svg = d3
     .select(selector)
     .append("svg")
-    .attr("width", width)
+    .attr("width", "100%")
     .attr("height", height);
 
   // Init simulation:
-- 
GitLab