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

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

以上繪製選擇權損益程式碼

<style>
h1{background-color: purple; color:white; padding: 10px;}
.a{background-image: linear-gradient(white, yellow); font-size: 32px; line-height:1.5}
.b{background-image: linear-gradient(white, blue); color: white; font-size:30px}
</style>
<h1>canvas繪圖套件繪製選擇權到期日損益圖</h1>
<p>
<BUTTON ONCLICK="buy()">買入選擇權到期日損益</BUTTON>
<BUTTON ONCLICK="sell()">賣出選擇權到期日損益</BUTTON>
  </p>
<canvas height="150" id="BuyOptions" width="600"></canvas>
<canvas height="150" id="SellOptions" width="600"></canvas>
<script>
function buy(){  
const c = document.getElementById("BuyOptions");
const ctx = c.getContext("2d");
ctx.strokeStyle = "green";
ctx.lineWidth = 5;
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.stroke();
}
function sell(){
const c = document.getElementById("SellOptions");
const ctx = c.getContext("2d");
ctx.strokeStyle = "blue";
ctx.lineWidth = 5;
ctx.beginPath();
ctx.moveTo(0, 110);
ctx.lineTo(100, 10);
ctx.lineTo(200,10);
ctx.font = "16px Arial";
ctx.fillText("賣出賣權puts的到期日損益",0,130);
ctx.moveTo(300, 10);
ctx.lineTo(400, 10);
ctx.lineTo(500, 110);
ctx.fillText("賣出買權callss的到期日損益",300,130)
ctx.stroke();//繪製
}
</script>

在HTML模式貼上甲班示範結果

identifier名稱,身分證id card

drums,guitar,vocals,bass,singer

五百狂,侯麗鷗,蔡依雯,林志玲,劉任昌

drums手: 五百狂
guitar手: 侯麗鷗
vocals手: 蔡依雯
bass手: 林志玲
singer手: 劉任昌

w3schools學物件

留言

  1. https://d10836153.blogspot.com/2023/12/javascriptobject.html

    回覆刪除
  2. https://keiime.blogspot.com/2023/12/javascriptcanvas.html

    回覆刪除
  3. https://wilson11122.blogspot.com/2023/12/blog-post.html

    回覆刪除
  4. https://amyxl6316.blogspot.com/2023/12/canvas-const-c-document.html

    回覆刪除
  5. https://cindy650092.blogspot.com/2023/12/javascriptobject.html

    回覆刪除
  6. https://whitexd.blogspot.com/2023/12/javascriptobjectcanvas.html

    回覆刪除
  7. https://kk0725.blogspot.com/2023/12/javascriptobjectcanvas.html

    回覆刪除
  8. https://kitty030994.blogspot.com/2023/12/javascriptobjectcanvas.html

    回覆刪除
  9. https://oscarliu1688.blogspot.com/2023/12/htmlcssjavascriptjavapython.html

    回覆刪除
  10. https://tustning.blogspot.com/2023/12/javascriptobjectccanvas.html

    回覆刪除
  11. https://rrrrr-eeeee.blogspot.com/2023/12/javascriptcanvas.html

    回覆刪除
  12. https://www.blogger.com/blog/post/edit/preview/7698579018900065546/95855517333286878

    回覆刪除
  13. https://htmlcssjavascriptjavapython.blogspot.com/2023/12/javascriptobjectcanvas.html

    回覆刪除
  14. https://asd0908449304.blogspot.com/2023/12/javascriptobjectcanvas.html

    回覆刪除
  15. https://ctz642895.blogspot.com/2023/12/javascriptobjectcanvas.html

    回覆刪除
  16. https://hui026.blogspot.com/2023/12/javascriptobject.html

    回覆刪除
  17. https://xi715.blogspot.com/2023/12/javascriptobjectcanvas.html

    回覆刪除
  18. https://grace8166.blogspot.com/2023/12/javascriptobjectcanvas.html

    回覆刪除
  19. https://russellma2005525.blogspot.com/2024/01/canvas.html

    回覆刪除

張貼留言

這個網誌中的熱門文章

甲劉任昌python串列List(陣列Array),元組Tuple,集合Set,字典Dict

劉任昌PYTHON陣列ARRAY串列LIST字典DIC集合SET元組TUPLE

劉任昌Javascript與Python比較