Real time graph plotting starting time

前端 未结 1 1319
庸人自扰
庸人自扰 2020-12-04 04:08

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         


        
相关标签:
1条回答
  • 2020-12-04 04:37

    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.

    1. Make nMoments a multiple of 60.

      dataset = new DynamicTimeSeriesCollection(1, 960, new Second());
      dataset.setTimeBase(new Second(0, 0, 0, 1, 1, 2014));
      
    2. 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.

    0 讨论(0)
提交回复
热议问题