劉子鳴JavaScript物件object繪圖canvas繪製選擇權到期日損益

canvas繪圖套件繪製選擇權到期日損益圖

以上為繪圖原始碼

<h1>canvas繪圖套件繪製選擇權到期日損益圖</h1>
<canvas id="BuyOptions" width="500" height="300"></canvas>
<script>
const c = document.getElementById("BuyOptions");
const ctx = c.getContext("2d");
ctx.beginPath();
ctx.moveTo(0, 0);
ctx.lineTo(100, 100);
ctx.lineTo(200,100);
ctx.font = "16px Arial";
ctx.fillText("買入賣權puts的到期日損益",0,120);
ctx.moveTo(300, 100);
ctx.lineTo(400, 100);
ctx.lineTo(500, 0);
ctx.fillText("買入買權callss的到期日損益",300,120);
ctx.moveTo(0, 300);
ctx.lineTo(100, 200);
ctx.lineTo(200,200);
ctx.font ="30pt";
ctx.fillText("賣出賣權puts的到期日損益",0,180);
ctx.moveTo(300, 200);
ctx.lineTo(400, 200);
ctx.lineTo(500, 300);
ctx.fillText("賣出買權callss的到期日損益",300,180)
ctx.stroke();//繪製
</script>

在HTML模式下貼上甲班示範

identifier名稱,身分證id card

W3school學物件

留言

這個網誌中的熱門文章

金三甲期末考重要題庫與額未加分作業

空頭價差多頭價差跨式勒式

劉子鳴:行為財務 BRK波克夏海瑟威公司股價