how do i print categoryitem labels in allternative lines....

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Locked
sreehari.ojili
Posts: 14
Joined: Tue May 06, 2008 5:57 am

how do i print categoryitem labels in allternative lines....

Post by sreehari.ojili » Fri May 09, 2008 10:49 am

hi to every one i created on dual axis chart(combination of bar & line chart). i am using CategoryDataset. in that i am facing one more problem i need to put one small line between each categories.. and i need to print category labels in in two lines alternatively...

i have only one series in my domain axis(categories).. i am print 30 items(dates) in domain axis. first item label(01/03) has to print in first line and second item label(02/03) has to print in another line..please help me to come out of this problem.

it needs to be print as mentioned below order

___|___|___|___|___|___|___|___|___|___|___|___|___| domain axis
01/03 03/03 05/03 07/03 09/03
02/03 04/03 06/03 07/03

xiaoiaozi
Posts: 2
Joined: Mon Jun 02, 2008 5:08 am

Re: how do i print categoryitem labels in allternative lines

Post by xiaoiaozi » Mon Jun 02, 2008 5:10 am

you can use sublist to achieve the second line text.

sreehari.ojili
Posts: 14
Joined: Tue May 06, 2008 5:57 am

Post by sreehari.ojili » Mon Jun 02, 2008 12:17 pm

thanks a lot for ur reply, ok i will try it by using sub list. once again thanks to u.

samtuen
Posts: 5
Joined: Mon Jun 30, 2008 2:00 pm
Location: Germany

Post by samtuen » Mon Jun 30, 2008 2:19 pm

Hi sreehari.ojili,

did you solve the problem? If yes, can u tell me, how to do it. I thanks you in advance.

I use category line chart. Because the category text is too long, so i want that they are displayed alternate in 2 lines.

sreehari.ojili
Posts: 14
Joined: Tue May 06, 2008 5:57 am

Post by sreehari.ojili » Mon Jun 30, 2008 2:38 pm

hi samtuen,

i guess the following code will solve your problem

Code: Select all

categoryAxis.setMaximumCategoryLabelLines(lines)
my senerio is bit different from u..

-Sreehari Ojili

samtuen
Posts: 5
Joined: Mon Jun 30, 2008 2:00 pm
Location: Germany

Post by samtuen » Mon Jul 07, 2008 11:43 am

Hi Sreehari Ojili,

thank you for your reply. With the method

Code: Select all

categoryAxis.setMaximumCategoryLabelLines(lines)
overlapping can be avoided (the text break in line 2) , but I want that the category texts are displayed alternate on 2 lines. Can you do it?

avanidhar
Posts: 16
Joined: Wed Jun 11, 2008 10:47 pm

Post by avanidhar » Mon Jul 07, 2008 3:28 pm

i have been tweeking around with your exact problem and could not find a proper solution to it either on the forum or by looking through the API docs. So, i used an additional axis on the right side of the chart with the same range as the primary axis and added the label to it.

samtuen
Posts: 5
Joined: Mon Jun 30, 2008 2:00 pm
Location: Germany

Post by samtuen » Mon Jul 07, 2008 4:28 pm

Hi avanidhar,

could it be, that you mean y-axis (... an additional axis on the right side of the chart ...)

Locked