0

Possible Duplicate:
Using JFreeChart to display recent changes in a time series

Before asking, I've been looking for information about my concern with JfreeChart but I have been unable to come out with a solution, so sorry if this question was already posted.

I've programmed an application that receives real-time information from a wireless sensor device (n readings from a temperature sensor every second). To plot this information, I use the JFreeChart libraries, in particular, the DinamicTimeSeriesCollection class.

According with the functionality of this class: "This class is aimed for real-time applications in which we have the ability to append new data and discard the oldest in a pretty fast way (depend on your input data)" (retrieved from JfreeChart: Scroll XYBarChart Horizontally - (chart translation and navigation)), what I need is not to discard the information which has been already plotted. I've seen that I can scroll the graph horizontally by adding a JSlider as it is shown in the aforementioned url. However, I cannot see old values (mostly because they have been replaced).

I'm not sure if I am using the correct class, if there is another libraries like JfreeChart that makes plotting graphs "as easy" or even if there is any trick or method to keep the old values.

Thanks a lot for your time. All the help possible would be appreciated.

Regards

David

Community
  • 1
  • 1
  • You might also look among the [examples cited here](http://stackoverflow.com/tags/jfreechart/info). – trashgod Jul 19 '12 at 19:40

1 Answers1

0

A good approach is to store the values that are being received from the device in a 2D listarray (representing x,y coordinates) and pass those points to JFreeChart to be plotted everytime a new value is received. As for panning you can manually set the window with JFreeChart.getXYPlot().get[Domain/Range]axis.set[Upper/Lower]Bounds(double value)

retrohacker
  • 3,194
  • 4
  • 21
  • 31