real time chart

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Locked
mguerra
Posts: 4
Joined: Wed Oct 08, 2003 9:05 pm

real time chart

Post by mguerra » Wed Dec 10, 2003 8:29 pm

Is there some way to add a scroll bar to a real time graph such as the one in the Memory example. In other words as time goes on I want the option to be able to scroll back to look at data from some time ago. How would i go about implementing this???

david.gilbert
JFreeChart Project Leader
Posts: 11734
Joined: Fri Mar 14, 2003 10:29 am
antibot: No, of course not.
Contact:

Post by david.gilbert » Thu Dec 11, 2003 11:16 am

You can't add a scrollbar within the chart, because the chart is just painted using Graphics2D, but you could add one outside the ChartPanel and have it modify the axis range depending on the scrollbar value. You could also use a JSlider for this purpose.
David Gilbert
JFreeChart Project Leader

:idea: Read my blog
:idea: Support JFree via the Github sponsorship program

mguerra
Posts: 4
Joined: Wed Oct 08, 2003 9:05 pm

Post by mguerra » Thu Dec 11, 2003 4:31 pm

I dont necessarily need a scroll bar, i guess a slider would be just as good. My question is more a matter of how would I go about implementing the functionality of being able to view real time data that has already scrolled past the end of the screen. Suppose you have time on the x axis and you are able to display 60 seconds of data on the screen, after 60 seconds the display will show only the most recent 60 seconds of data. i want to be able to scroll (or use a slider) to go back and look at the other data. How could this be implemented, couuld you give me any general ideas. thanks. mike

Eduardo Ramalho
Posts: 43
Joined: Fri Mar 14, 2003 3:14 pm
Location: Porto (Portugal)
Contact:

Post by Eduardo Ramalho » Mon Dec 15, 2003 12:58 pm

Hi!

See this:
http://www.jfree.org/phpBB2/viewtopic.p ... hlight=pan

I think that you can have that effect by using that example and by zooming the chart before plotting the samples. While zoomed you will see the chart updating in realtime. At some point, when you need to go back, you "pause" the chart (turn off the dataset event listeners) and use the scrool bar to go back and see the previous sample history.

Regards,

Eduardo

Locked