Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   Java (http://www.velocityreviews.com/forums/f30-java.html)
-   -   customising date on x-axis in JFreeChart (http://www.velocityreviews.com/forums/t390427-customising-date-on-x-axis-in-jfreechart.html)

ameyas 01-29-2007 07:15 AM

customising date on x-axis in JFreeChart
 
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 01-29-2007 09:25 AM

Re: customising date on x-axis in JFreeChart
 


On 29 Sty, 08:15, "ameyas" <amey.sam...@gmail.com> wrote:
> 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


ameyas 01-29-2007 09:45 AM

Re: customising date on x-axis in JFreeChart
 

now wouldn't that throw ClassCastException ?


On Jan 29, 2:25 pm, "dnx" <dyn...@gmail.com> wrote:
> On 29 Sty, 08:15, "ameyas" <amey.sam...@gmail.com> wrote:
> ((DateAxis) plot.getDomainAxis()).setDateFormatOverride(new
> SimpleDateFormat("dd"));
>
> DNX



dnx 01-29-2007 10:22 AM

Re: customising date on x-axis in JFreeChart
 


On 29 Sty, 10:45, "ameyas" <amey.sam...@gmail.com> wrote:
> now wouldn't that throw ClassCastException ?
>



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



All times are GMT. The time now is 04:09 PM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.