Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
145
Marker rotation
posted

We had Calculated the angle by using this code for the marker line to be drawn

let angle = Math.atan2( nextdata.y - y, nextdata.x - x ) * ( 180 / Math.PI )

            let xOffset = 2;

            let yOffset = 0;

            ctx.fillText("", x - (xOffset), y - (yOffset));

            ctx.strokeStyle = "rgb(161, 167, 179)";

            ctx.fillStyle = "white";

            ctx.beginPath();

            ctx.lineTo(x, y);

            //todo_updated point

            ctx.lineTo(x + 8, y);

            ctx.stroke();

            ctx.fill();

   

based on the angle how to rotate the drawn line ?