jfreechart中一条线上的点 [英] Points on a line in jfreechart
问题描述
如何在 jfreechart 中的图表中获取连接两个数据点的线上的所有点 (x,y)?
How to get all the points (x,y) lying on the line connecting two data-points in a chart in jfreechart ?.
在图表中,当我们指向线的端点时,它显示了 x &y 坐标.我们不能得到线上任意一点的坐标吗(通过代码)?
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)?
推荐答案
由于您有两点,请使用 线性方程得到直线的斜率和截距.有了等式后,您就可以随时对其进行评估.
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.
附录:org.jfree.data.statistics.Regression
类为回归分析提供了一些内置支持.
Addendum: The org.jfree.data.statistics.Regression
class offers some built-in support for regression analysis.
这篇关于jfreechart中一条线上的点的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!