Show/Hide Tick Marks

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Locked
hsp707
Posts: 18
Joined: Thu May 15, 2008 4:58 pm

Show/Hide Tick Marks

Post by hsp707 » Wed Jun 25, 2008 11:05 pm

Hello everybody,

Trying to figure out this .......

Is it possible to hide all the tick marks in between BUT keep the ones on the ends - I just want to show the lower bound tick mark and tick label and similarly the upper bound tick mark and the tick label. I want to hide the in between tick marks and labels e.g. like this
0 100
|_____________________________________|


and not like

0 10 20 30 40 50 60 70 80 90 100
|___|___|____|__|___|____|___|____|___|___|


If I setTickMarksVisible(false) then all the tick marks are hidden, similarly setTickLabelsVisible(false) sets off all the tick labels, including the end ones.

Don't think if I can do this, but still no harm in askign from experts.

Thanks a lot.

hsp

gummibear
Posts: 4
Joined: Wed Apr 11, 2007 4:29 pm
Location: Germany
Contact:

Post by gummibear » Thu Jun 26, 2008 12:07 pm

Hallo hsp,
have you tried

Code: Select all

axis.setTickUnit(new NumberTickUnit(100));
Bye

hsp707
Posts: 18
Joined: Thu May 15, 2008 4:58 pm

Post by hsp707 » Thu Jun 26, 2008 3:23 pm

thanks gummibear,

Yes, I had thought about it but never tried it - :D
I just assumed that if I do that it will make my graph wrong - hehe, Now you can tell how amateur I am for the JFreechart. But as you mentioned, I thought - why don't I just try it and it did without doing my graph wrong.

Thanks a bunch.

jet
Posts: 4
Joined: Thu Aug 05, 2010 3:16 pm
antibot: No, of course not.

Re: Show/Hide Tick Marks

Post by jet » Thu Aug 05, 2010 3:23 pm

Hi guys, i have something like this on my x axis

1,2...1,3..1,4...1,5..1,6
|___|____|___ |___|

so how can i remove labels that i do not need(example bellow)

1,2 ........1,4........1,6
|___|____|___ |___|

next code works for y axis not for x

Code: Select all

        NumberAxis axis =   (NumberAxis) plot.getRangeAxis();
        axis.setTickUnit(new NumberTickUnit(0.2));
sorry if this is kinda stupid question, but i already spent ours in google
Thanx)

skunk
Posts: 1087
Joined: Thu Jun 02, 2005 10:14 pm
Location: Brisbane, Australia

Re: Show/Hide Tick Marks

Post by skunk » Thu Aug 05, 2010 4:35 pm

change getRangeAxis() to getDomainAxis()

jet
Posts: 4
Joined: Thu Aug 05, 2010 3:16 pm
antibot: No, of course not.

Re: Show/Hide Tick Marks

Post by jet » Thu Aug 05, 2010 4:58 pm

thanks, but it doesn't work, cuz method getDomainAxis() returns CategoryAxis, so its gonna be

Code: Select all

CategoryAxis domainAxis = plot.getDomainAxis ();
when i wrote this

Code: Select all

NumberAxis axis =   (NumberAxis) plot.getDomainAxis();
it said "inconvertible types"

skunk
Posts: 1087
Joined: Thu Jun 02, 2005 10:14 pm
Location: Brisbane, Australia

Re: Show/Hide Tick Marks

Post by skunk » Thu Aug 05, 2010 5:48 pm

Search this list for "skip categoryaxis"

One of the returned links should reference this thread
http://www.jfree.org/phpBB2/viewtopic.p ... 67&start=0

Locked