2

How to get all the points (x,y) lying on the line connecting two data-points in a chart in jfreechart ?.

In a chart, as we point to the end-points of the line, it shows the x & y coordinates. Can't we get the coordinates at any point on the line (via code)?

vkantiya
  • 1,343
  • 1
  • 8
  • 20

1 Answers1

2

As you have two points, use the formulae of a linear equation to obtain the slope and intercept of the line. Once you have the equation, you can evaluate it at any point.

Addendum: The org.jfree.data.statistics.Regression class offers some built-in support for regression analysis.

trashgod
  • 203,806
  • 29
  • 246
  • 1,045