Here is code based on @trashgod\'s example about real time plotting:
import java.awt.EventQueue;
import java.awt.event.ActionEvent;
import java.awt.event.Act
The graph starts at 16 minutes and 40 seconds after midnight on the date used to construct the Second
passed to setTimeBase()
. This is the same 1000 intervals, each one second long, specified in the nMoments
constructor parameter. Some possible alternatives to get a zero-based display, given a time set to midnight.
Make nMoments
a multiple of 60
.
dataset = new DynamicTimeSeriesCollection(1, 960, new Second());
dataset.setTimeBase(new Second(0, 0, 0, 1, 1, 2014));
Subtract nMoments
from the nominal base date.
int nMoments = 1000;
dataset = new DynamicTimeSeriesCollection(1, nMoments, new Second());
Calendar c = Calendar.getInstance();
c.setTime(new Date(0));
c.add(Calendar.SECOND, -nMoments);
dataset.setTimeBase(new Second(c.getTime()));
Either approach yields the same display.