0

I am using a TimeSeriesChart (jfreechart) to represent data with a chart that shows 24h. Each point of the curve consists of a double value (y axis) and a timestamp including milliseconds (x axis). If make sure that I have at least a value at 00:00:00 and at 23:59:59 - how many points there are inbetween depends on the data.

JFreeChart connects the points which are provided automatically to a curve so I was wondering if it's possible to ask the chart what a curves value is at a certain time, e.g.

assume I have a series with 4 points:

1.1.2012 00:00:00.000 - value = 0
1.1.2012 01:00:00.000 - value = 60
1.1.2012 23:00:00.000 - value = 600

and I let JFreeChart connect these points - is there any way to ask JFreeChart for the value at e.g. 22:30:00 even though I didn't provide a data point for this time?

thanks

1 Answers1

1

Because the points are connected with straight lines, you can use linear interpolation, as suggested here. For polynomial regression, consider LUDecompositionImpl.

Community
  • 1
  • 1
trashgod
  • 203,806
  • 29
  • 246
  • 1,045
  • Revised in 1.0.14, the built-in `Regression`, cited [here](http://stackoverflow.com/a/10094620/230513). – trashgod Apr 11 '12 at 05:57