From 183ec0d5bf0f4a52da95ed8100fccce806c92ec4 Mon Sep 17 00:00:00 2001 From: Benjamin Arntzen Date: Thu, 27 Jun 2024 11:09:53 +0100 Subject: [PATCH] Separated pie chart update from node update and added throttling for both. --- public/app.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/public/app.js b/public/app.js index 6f7e935..258949e 100644 --- a/public/app.js +++ b/public/app.js @@ -347,6 +347,7 @@ window.addEventListener('resize', resizeAndCenterNetwork); let lastUpdateTime = 0; +let lastPieChartUpdateTime = 0; const updateInterval = 120; // 120ms throttle function updateNodes() { @@ -355,10 +356,16 @@ function updateNodes() { nodes.update(nodesToUpdate); nodesToUpdate = []; calculateSmallGroups(); - updatePieChartThrottled(); updateCounter(); lastUpdateTime = currentTime; } + + // Separate throttle for pie chart update + if (currentTime - lastPieChartUpdateTime >= updateInterval) { + updatePieChart(); + lastPieChartUpdateTime = currentTime; + } + setTimeout(updateNodes, updateInterval); }