コンテキストのオブジェをcotとします。
//pathの初期化
cot.beginPath();
//始点に移動
cot.moveTo(20,20);
//線の終点
cot.lineTo(100,100);
//破線
cot.setLineDash([10,10,30,10]);
描画 間隙 描画 間隙 繰り返し
//線の色
cot.strokeStyle="red";
//線の頭
cot.lineCap="round";
butt,square
//線の太さ
cott.lineWidth=3;
//描画する
cot.stroke();