Problem with setting time span in x-axis

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Locked
smilegloria
Posts: 4
Joined: Sat Mar 15, 2003 5:10 pm

Problem with setting time span in x-axis

Post by smilegloria » Fri Jun 25, 2004 5:50 am

Hi all,

I want to create a time series with different time span. For example, user can select the time span of Quarterly, Half-yearly and Yearly. If the user chose Quarterly, the result time series will have dates 1/2004, 4/2004, 7/2004, 10/2004 in x-axis. If the user chose Half-yearly, the result time series will have dates 1/2004, 6/2004, etc. How can do this?

Many thanks!

BRgds,
Gloria :shock:

lamdor

like this..

Post by lamdor » Fri Jun 25, 2004 8:47 am

Hello,

The main thing in Time series is the number of TIME PERIODs u add that many time slots will be shown.

In ur case u need to add 4 slots for QUAT.. and 2 slots for HALF..like same.

So the number of slots u add that many periods will be shouwn.

Check the example of time series graph ..u will surely understand its very easy.

smilegloria
Posts: 4
Joined: Sat Mar 15, 2003 5:10 pm

Post by smilegloria » Fri Jun 25, 2004 9:07 am

Sorry, I'm not really understand what is the slot you mean..
The data are distributed thoughout the year..
What I want is to divide the date axis label into quarterly, half-yearly or yearly format..

RCDran
Posts: 29
Joined: Wed Feb 25, 2004 4:18 am
Location: Japan

Post by RCDran » Fri Jun 25, 2004 9:39 am

I think you need to add data pertaining to months say from Jan to Dec (all 12 months) and want to show the tick as 1,4,7,10 (when selected Quarterly) and 1,7 (when selected as Halfyearly). But the data will be still plotted for all the months. Is that right?

If yes you can set the Domain Axis with

Code: Select all

domainAxis.setTickUnit(new DateTickUnit(1,3)); // Quarterly
domainAxis.setTickUnit(new DateTickUnit(1,6)); // Half-Yearly
If *NOT* Pls ignore this.
--
RCDran

smilegloria
Posts: 4
Joined: Sat Mar 15, 2003 5:10 pm

Post by smilegloria » Fri Jun 25, 2004 10:14 am

Thx!

I have used another method:
// quarterly
standardUnits.add(
new DateTickUnit(DateTickUnit.MONTH, 3, new SimpleDateFormat("MM-yyyy"))
);

// half-yearly
standardUnits.add(
new DateTickUnit(DateTickUnit.MONTH, 6, new SimpleDateFormat("MM-yyyy"))
);

// yearly
standardUnits.add(
new DateTickUnit(DateTickUnit.YEAR, 1, new SimpleDateFormat("yyyy"))
);

Cheers,
Gloria :D

Tahsnks

Hope someone could help

Post by Tahsnks » Fri Jul 16, 2004 5:18 pm

How about if I wanted to express a time period for 60 days. how can I do this

Locked