diff --git a/plugins/sentinel/dashboard.html b/plugins/sentinel/dashboard.html index a1a33e0..47c84e7 100644 --- a/plugins/sentinel/dashboard.html +++ b/plugins/sentinel/dashboard.html @@ -157,12 +157,12 @@ window.addEventListener('resize', function(){ self._resize(); }); } HiChart.prototype._resize = function() { - var rect = this.canvas.parentElement.getBoundingClientRect(); - var w = Math.max(rect.width - 8, 100); - var h = 60; + // 用 canvas 自身的 CSS 渲染尺寸 → 内部分辨率 = CSS尺寸 × DPR (保持高清) + var box = this.canvas.getBoundingClientRect(); + var w = box.width, h = box.height; + if (w <= 0 || h <= 0) { w = 280; h = 60; } // fallback this.canvas.width = w * this._dpr; this.canvas.height = h * this._dpr; - // CSS controls display size via width:100%;height:60px this.ctx.setTransform(this._dpr, 0, 0, this._dpr, 0, 0); this._draw(); };