1

I want to create a RegularTimePeriod object with hour,min,seconds i have,how to do this i googled and got http://www.jfree.org/jfreechart/api/javadoc/org/jfree/data/time/RegularTimePeriod.html but i dont seem to understand what RegularTimePeriod contain create one.

in short lets say i have 02:33:54 i have broken it into h=02,m=33,s=54 now can i create a regulartimeperiod object with h,m,s?if so how

if not which object can pass to TimeSeries in jfreechart to get hh:mm:ss format along x-axis

Thanks in advance

HkFreaKuser1673718
  • 759
  • 4
  • 13
  • 31

1 Answers1

1

You can override the date format. Related examples may be found here and here.

axis.setDateFormatOverride(DateFormat.getTimeInstance());
Community
  • 1
  • 1
trashgod
  • 203,806
  • 29
  • 246
  • 1,045
  • trashgod Thanks i didnt not understand ur solution is for RegularTimeperiod or "if not which....." part i will try googling – HkFreaKuser1673718 Oct 17 '12 at 12:28
  • You are welcome, but I'm not sure I understand. A `DateAxis` displays "milliseconds from the Java [epoch](http://en.wikipedia.org/wiki/Epoch_%28reference_date%29)." The `setDateFormatOverride()` method merely supplies the format. Think of the chart as a _view_ and the data set as a _model_, as shown [here](http://stackoverflow.com/a/3072979/230513). Try changing the format to `getTimeInstance()` in the second [example](http://stackoverflow.com/a/12481509/230513) to see the effect. – trashgod Oct 17 '12 at 13:48
  • If you have no date information, i.e. all times are relative to `00:00:00`, you can set the time zone of the formatter to `GMT`, as shown [here](http://stackoverflow.com/a/2705674/230513). – trashgod Oct 18 '12 at 19:16