A discussion forum for JFreeChart (a 2D chart library for the Java platform).
-
gk11
Post
by gk11 » Sun Nov 02, 2003 9:19 am
hi;
i am new to jfree and need a time chart.
for every value in the chart i need to display the date and time in a minute granularity.
for example: 1.1.2003 17:53.
i created a chart and put Minute objects in the timeSeries but the display only shows the hours and minutes (no date).
how can i achieve what i want.
i would appretiate any response.
thanks.;

-
Jeffh
- Posts: 13
- Joined: Thu Oct 09, 2003 9:47 am
Post
by Jeffh » Thu Nov 06, 2003 8:03 am
Try this, it worked for me. By default i believe the chart narrows down the displayed to to the most relevant, ie if all your date/times are the same day, it will only display hours, minutes, etc...
XYPlot plot = chart.getXYPlot();
DateAxis dateAxis = (DateAxis) plot.getDomainAxis();
axis.setDateFormatOverride(
new SimpleDateFormatter("dd.MM.yyyy HH:mm");
this should default all the dates on the domain axis to the format you wanted in your post. If you want a different format, you can look up the SimpleDateFormatter javadocs and check out the legal date formats. You can pretty much choose just about anythin.
Jeff