Hi All,
I'm creating a TimeSeries chart with an XYDataset..
I need to have the time value set as both a date and a time.
For example, instead of just saying "Jan 1 2004" I need the time to say something like "Jan 1 2004 12:30"
Is this possible using JFreeChart?
The data I'm displaying have multiple values per day..
Thanks,
Jim
Day and Hour for XYDataset
Hi Jim,
it is possible with JFreeChart.
You can change the time period in the constructor towards day, month, quarter, year etc. and add data items to the series depending on the selected time period
This is an example for hourly data:
TimeSeries s1 = new TimeSeries("Name", Hour.class);
int hour=2;
Calendar helpdate = Calendar.getInstance();
helpdate.set(2004,2,2);
s1.add(new Hour(hour, new Day(helpdate)), Price);
Hope this helps
Martin
it is possible with JFreeChart.
You can change the time period in the constructor towards day, month, quarter, year etc. and add data items to the series depending on the selected time period
This is an example for hourly data:
TimeSeries s1 = new TimeSeries("Name", Hour.class);
int hour=2;
Calendar helpdate = Calendar.getInstance();
helpdate.set(2004,2,2);
s1.add(new Hour(hour, new Day(helpdate)), Price);
Hope this helps
Martin
Hi Martin,
Thanks very much for this info.. It seems to be exactly what I'm looking for with one exception.. Looking at the Hour class, there doesn't seem to be a constructor or method that allows one to set the minute as well.
The values I'm adding need to be marked right down to the minute like 02:48 or 16:35 and so on.
Are 'minutes' supported?
Jim
Thanks very much for this info.. It seems to be exactly what I'm looking for with one exception.. Looking at the Hour class, there doesn't seem to be a constructor or method that allows one to set the minute as well.
The values I'm adding need to be marked right down to the minute like 02:48 or 16:35 and so on.
Are 'minutes' supported?
Jim
Jim,
check the RegularTimePeriod.class
http://www.jfree.org/jfreechart/javadoc ... eriod.html
In this case the Minute.class fits your needs.
Martin
check the RegularTimePeriod.class
http://www.jfree.org/jfreechart/javadoc ... eriod.html
In this case the Minute.class fits your needs.
Code: Select all
TimeSeries s1 = new TimeSeries("Name", Minute.class);
int minute=48;
int hour=2;
Calendar helpdate = Calendar.getInstance();
helpdate.set(2004,2,2);
s1.add(new Minute(minute, new Hour(hour, new Day(helpdate))),Price);