Scrollable DynamicTimeSeriesCollection JFreeChart

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Locked
rlodermeier
Posts: 4
Joined: Thu Jul 07, 2016 10:26 pm
antibot: No, of course not.

Scrollable DynamicTimeSeriesCollection JFreeChart

Post by rlodermeier » Thu Jul 07, 2016 10:47 pm

Hey folks,

Here is my problem...

I have an application that I want to create that will run for 8-10 hours, possibly longer. I want to use JFreeChart to replicate a Strip chart (like what many computers use when reviewing Network Utilization). I plan to add a point to the graph every second to display the Rx/Tx Bit Rates leaving and coming into my LAN over time. I want the graph to show 20 minutes of data without scrolling, but with the ability to go back in time to review the rates.

The point if the application is to analyze Bit Rates over the length of a shift, or a day at the office. Does JFreeChart offer anything like this?

John Matthews
Posts: 513
Joined: Wed Sep 12, 2007 3:18 pm

Re: Scrollable DynamicTimeSeriesCollection JFreeChart

Post by John Matthews » Fri Jul 08, 2016 3:01 am

One approach would be to add data to both a DynamicTimeSeriesCollection and a TimeSeries. Use the former to display 20 * 60 seconds of recent data in a strip chart; use the latter to display setMaximumItemAge() values in a zoomable time series chart. Switch views using CardLayout or a JTabbedPane. Use a SwingWorker to collect data in the background and publish() intermediate results; update the datasets in your implementation of process(); each dataset's listening chart will update itself in response.

rlodermeier
Posts: 4
Joined: Thu Jul 07, 2016 10:26 pm
antibot: No, of course not.

Re: Scrollable DynamicTimeSeriesCollection JFreeChart

Post by rlodermeier » Mon Jul 11, 2016 5:36 pm

So what you are saying is I would need 1 graph that is dynamic and a second one that displays all data. There is not a way to scroll back in time on one graph? The DynamicTimeSeriesCollection will plot every second while the TimeSeries will give a snap shot in time that includes all plotted points.

John Matthews
Posts: 513
Joined: Wed Sep 12, 2007 3:18 pm

Re: Scrollable DynamicTimeSeriesCollection JFreeChart

Post by John Matthews » Mon Jul 11, 2016 6:34 pm

I'm not aware of a better approach. I think of it as two views of the same data. You might aggregate the DynamicTimeSeriesCollection and the TimeSeriesCollection so that process() has a common method to update both datasets at once. You can add addition datasets to hold less frequent data for longer time frames.

rlodermeier
Posts: 4
Joined: Thu Jul 07, 2016 10:26 pm
antibot: No, of course not.

Re: Scrollable DynamicTimeSeriesCollection JFreeChart

Post by rlodermeier » Mon Jul 11, 2016 6:58 pm

Thank you, that did help a lot. There is no telling how long I might have went down a rabbit hole to figure out what I am exactly looking for is not possible. You just saved me quite a few hours of work.

I will intend to create separate graphs. Either Multiple DynamicTimeSeriesCollections with different Max Data counts and time intervals, or make all of the other ones besides my main graph a Time Series Graphs.

Locked