Points on a line in jfreechart

2020-02-15 01:45发布

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)?

1条回答
趁早两清
2楼-- · 2020-02-15 02:26

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.

查看更多
登录 后发表回答