VOOZH about

URL: https://www.geeksforgeeks.org/javascript/d3-js-path-lineto-function/

⇱ D3.js path.lineTo() Function - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

D3.js path.lineTo() Function

Last Updated : 7 Aug, 2020

The path.lineTo() function is used to draw a line to a given point from the current set of points.

Syntax:

path.lineTo(x, y);

Parameters: It takes two parameters as mentioned above and described below.

  • x: It is the x-position of the point to which line is to be drawn.
  • y: It is the y-position of the point to which line is to be drawn.

Return Value: It does not return any value.

Example 1: Making a line from (0, 0) to (100, 100).

Output:

👁 Image

Example 2: Making a square using lineTo() function.

Output:

👁 Image
Comment
Article Tags: