fix: 强制创建HiChart(不再依赖缓存)
This commit is contained in:
@@ -321,7 +321,16 @@
|
||||
}
|
||||
grid.appendChild(card);
|
||||
_cardCache[id] = card;
|
||||
if (isRow && !_chartInstances[id]) {
|
||||
if (isRow) {
|
||||
// 销毁旧图表实例
|
||||
if (_chartInstances[id]) {
|
||||
['cpu','mem','net'].forEach(function(k){
|
||||
if (_chartInstances[id][k] && _chartInstances[id][k].canvas) {
|
||||
var c = _chartInstances[id][k].canvas;
|
||||
c.getContext('2d').clearRect(0,0,c.width,c.height);
|
||||
}
|
||||
});
|
||||
}
|
||||
try {
|
||||
_chartInstances[id] = { cpu: null, mem: null, net: null };
|
||||
if (typeof MiniChart !== 'undefined') {
|
||||
@@ -331,7 +340,6 @@
|
||||
_chartInstances[id].net = new DualLineChart(id+'-net', '#bb9af7', '#c0a8f0');
|
||||
|
||||
}
|
||||
} catch(e) {}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -374,7 +382,6 @@
|
||||
if (charts.cpu) charts.cpu.update(cpuVal);
|
||||
if (charts.mem) charts.mem.update(memVal);
|
||||
if (charts.net) { charts.net.update(net.rx_bytes_sec||0, net.tx_bytes_sec||0); if (charts.net.maxVal < 102400) charts.net.maxVal = 102400; }
|
||||
} catch(e) {}
|
||||
}
|
||||
// 更新额外指标
|
||||
var loadEl = card.querySelector('.load-val');
|
||||
|
||||
Reference in New Issue
Block a user