diff --git a/XNSimHtml/components/data-monitor.js b/XNSimHtml/components/data-monitor.js
index f41e406..73b4b4c 100644
--- a/XNSimHtml/components/data-monitor.js
+++ b/XNSimHtml/components/data-monitor.js
@@ -1180,7 +1180,9 @@ class DataMonitor extends HTMLElement {
disconnectedCallback() {
this.isActive = false;
// 清理所有图表窗口
- this.chartWindows.forEach(window => {
+ this.chartWindows.forEach((window, windowId) => {
+ // 触发关闭事件,确保所有清理工作都完成
+ window.dispatchEvent(new CustomEvent('close'));
window.remove();
});
this.chartWindows.clear();