Real time graph plotting starting time

梦想与她 提交于 2019-11-27 16:25:05

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.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!