Separated pie chart update from node update and added throttling for both.

This commit is contained in:
Benjamin Arntzen
2024-06-27 11:09:53 +01:00
committed by Benjamin Arntzen (aider)
parent 10fd8cd461
commit 183ec0d5bf
+8 -1
View File
@@ -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);
}