Manipulation with Ticks near the DateAxis

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Locked
Max

Manipulation with Ticks near the DateAxis

Post by Max » Fri Jan 13, 2006 1:49 pm

Hello, everybody!
I'd like to ask you for advise.
I have DateAxis and it displays ticks like: 2006, 2007 etc.
But I have big amount of values, so I don't need to display all of them -
I've made them so they display like 2006 ... 2011 ... 2016 etc.
And from the other side, I need first and last tick to be shown anyway.
Now I have cases when 1st and last tick are invisible.
Can anybody answer me if I can dispaly axis ticks with some periodicity and
first and list values ticks must be shown.

Thank you for any answer.

david.gilbert
JFreeChart Project Leader
Posts: 11734
Joined: Fri Mar 14, 2003 10:29 am
antibot: No, of course not.
Contact:

Post by david.gilbert » Fri Jan 13, 2006 2:21 pm

This is a limitation of the DateAxis. It can probably be fixed, but it would need some extra code to detect overlapping labels. Please submit a feature request on the SourceForge page, if there isn't one there already.
David Gilbert
JFreeChart Project Leader

:idea: Read my blog
:idea: Support JFree via the Github sponsorship program

Sri
Posts: 5
Joined: Mon Jan 07, 2013 10:59 am
antibot: No, of course not.

Re: Manipulation with Ticks near the DateAxis

Post by Sri » Wed Jun 19, 2013 11:54 am

Hi David,

I came across same scenarios, please let me know weather this issue has been fixed.

I am just describing my scenarion below

I have Time Series on x-axis ranges from start date to end date. My logic is if the days are more than 30 then I am setting setAutoRange(true) , it is working but it is not displaying the start date and end date on x-axis. Then I added below logic but still it's not displaying start date and end date because tick unit gap. Please help me here. It's kind of urgent.

axis.setRange(lowerDate, upperDate);
if (daysDiff > 60 && daysDiff <= 150) {
axis.setTickUnit(new DateTickUnit(DateTickUnitType.DAY, 5));
} else if (daysDiff > 150 && daysDiff <= 300) {
axis.setTickUnit(new DateTickUnit(DateTickUnitType.DAY, 10));
} else if (daysDiff > 300){
axis.setTickUnit(new DateTickUnit(DateTickUnitType.DAY, 13));
}

Sri
Posts: 5
Joined: Mon Jan 07, 2013 10:59 am
antibot: No, of course not.

Re: Manipulation with Ticks near the DateAxis

Post by Sri » Thu Jun 20, 2013 3:13 pm

Hi Dave,

Could you let me know the solution for that.
I am trying to show both start date and end date on axis as mandatory and adjust the in between dates. It's very urgent for me.

- Sri

Locked