Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / January 2007

Tip: Looking for answers? Try searching our database.

customising date on x-axis in JFreeChart

Thread view: 
ameyas - 29 Jan 2007 07:15 GMT
hi

i am generating 3D bar chart. i am using CategoryAxis as x-axis.
the graph represents weekly statistics.
now due to space issues i would like to have date format on x-axis as
"dd" whereas in the tooltip i would like to display the entire date
yyyy-MM-dd.

how do i acheieve this?

i can create StandardCategoryToolTipGenerator but if i pass DateFormat
in this, it is applied to the value axis which is actually plain
numbers. i want to apply this format to domain (x) axis.

if i use date directly on the x-axis, i am facing space issues as the
label is not displayed properly.

so basically if the date is 29 Jan 2007 i want to display it  as
on x-axis  : 29
in tooltip : 2007-01-29

any clues ?

thanks & regards
amey
dnx - 29 Jan 2007 09:25 GMT
> hi
>
[quoted text clipped - 21 lines]
> thanks & regards
> amey

Something like this should work:

((DateAxis) plot.getDomainAxis()).setDateFormatOverride(new
SimpleDateFormat("dd"));

DNX
ameyas - 29 Jan 2007 09:45 GMT
now wouldn't that throw ClassCastException ?

> ((DateAxis) plot.getDomainAxis()).setDateFormatOverride(new
> SimpleDateFormat("dd"));
>
> DNX
dnx - 29 Jan 2007 10:22 GMT
> now wouldn't that throw ClassCastException ?

yes... :/
sorry, i haven't noticed what is your x-axis


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.