How could I draw a straight line with the equation y=m*x+n
in a jfreechart chart?
views:
552answers:
1
A:
Sounds simple enough ... I've never used it, but there is a XYPlot class which sounds like a decent place to start. You can create one using the ChartFactory, to make it a bit easier. You will need to implement a class that implements the XYDataSet interface, to return the actual points (i.e. evalutate your equation).
unwind
2009-05-11 11:45:02
By default XYPlot draws line(s) between the specified datapoints, so for a straight line you only need to specify two points. For instance (0, n) and (1, m+n).
Joonas Pulakka
2009-05-11 12:01:29