Home forums Using CanvasJS how to find a point exist on a line or not

This topic contains 2 replies, has 2 voices, and was last updated by  Vishwas R 1 week ago.

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #22992

    Prem@123
    Member

    I have two points, lets say x1,y1 and x2,y2. and i have one more point x3,y3, here is the question, i need to check is x3,y3 coordinate occurs in the line between x1,y1 and x2,y2 or not occurs in javascript.

    #22993

    Prem@123
    Member

    This is line over Canvas, so i want to detect that there is a line or not ?

    #23007

    Vishwas R
    Keymaster

    @prem123,

    With the help of Equation of Straight Line, you can detect if a point lies on the line or not. Please take a look at this JSFiddle.

    Also, please refer this stackoverflow thread for more info on achieving the same in JavaScript.


    Vishwas R
    Team CanvasJS

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.