テーブルのセルにバーを描画しようとしました。
すべて正常に動作しますが、ブラウザー ウィンドウのサイズを変更するたびに要素が失われました。セルサイズを手動で変更しても同じことが起こります。
誰かが助けることができますか?
私のキャンバスはこのように構築されています
HTML の場合:
<canvas id='0' width='260' height='10'> </canvas>
Javascript の場合:
var canvas = document.getElementById(0);
if (canvas && canvas.getContext) {
ctx = canvas.getContext('2d');
if (ctx) {
ctx.strokeStyle = 'red';
ctx.stroke();
ctx.fillStyle = '#8b0000';
ctx.fill();
ctx.font = "Bold 11px Arial";
ctx.fillText("Test", canvas.width - 248, canvas.height);
}
}