fix: MiniChart 2x DPR缩放

This commit is contained in:
qinglong
2026-06-14 13:53:56 +08:00
parent 939d9a96e0
commit ab5444d344
+8 -2
View File
@@ -273,8 +273,14 @@
try { try {
_chartInstances[id] = { cpu: null, mem: null, net: null }; _chartInstances[id] = { cpu: null, mem: null, net: null };
if (typeof MiniChart !== 'undefined') { if (typeof MiniChart !== 'undefined') {
_chartInstances[id].cpu = new MiniChart(id+'-cpu', '#7aa2f7'); _chartInstances[id].cpu = var mc = new MiniChart(id+'-cpu', '#7aa2f7');
_chartInstances[id].mem = new MiniChart(id+'-mem', '#9ece6a'); mc._origResize = mc.resize;
mc.resize = function(){ this._origResize(); this.canvas.width = this.canvas.width * 2; this.canvas.height = 120; this.ctx.scale(2,2); this.draw(); };
mc.resize();
_chartInstances[id].mem = var mm = new MiniChart(id+'-mem', '#9ece6a');
mm._origResize = mm.resize;
mm.resize = function(){ this._origResize(); this.canvas.width = this.canvas.width * 2; this.canvas.height = 120; this.ctx.scale(2,2); this.draw(); };
mm.resize();
} }
if (typeof DualLineChart !== 'undefined') { if (typeof DualLineChart !== 'undefined') {
_chartInstances[id].net = new DualLineChart(id+'-net', '#bb9af7', '#c0a8f0'); _chartInstances[id].net = new DualLineChart(id+'-net', '#bb9af7', '#c0a8f0');