customising date on x-axis in JFreeChart

A

ameyas

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
 
D

dnx

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


Something like this should work:

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

DNX
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,982
Messages
2,570,186
Members
46,743
Latest member
WoodrowMea

Latest Threads

Top