Amount of categories

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Locked
frambuesa
Posts: 3
Joined: Mon Jun 23, 2014 11:59 am
antibot: No, of course not.

Amount of categories

Post by frambuesa » Mon Jun 23, 2014 12:06 pm

Hi Support team,
Is that possible to create more than 10 categories in in bar chart? My data set have 20-30 categories and after desplaying 10 jfreechart start to overlay the categories values. I would like to show all categories in the chart.
Thank you in advance.

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

Re: Amount of categories

Post by david.gilbert » Mon Jun 23, 2014 1:03 pm

In the CategoryAxis class there is a setMaximumCategoryLabelLines() method that you can set to 2 or 3 to allow the labels to wrap onto multiple lines. Another option is to rotate the labels so that there is more space, for example: setCategoryLabelPositions(CategoryLabelPositions.UP_45) (try some of the other options in CategoryLabelPositions.

In Orson Charts, I implemented "stepped" labels to avoid the overlapping (once overlapping is detected, the every second label is shifted to another level to make more space, then later a third level etc.), and this works really well so at some point I'd like to add the same feature to JFreeChart.
David Gilbert
JFreeChart Project Leader

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

frambuesa
Posts: 3
Joined: Mon Jun 23, 2014 11:59 am
antibot: No, of course not.

Re: Amount of categories

Post by frambuesa » Tue Jun 24, 2014 7:46 am

Hi David,

thank you for your reply. I'm using this methos already, my issue is dealing not with labels formating, it is more about the number of categories in the bar chart. By default bar chart allows building of 10 categories, but I need 20 or 30. The reason for that is that I would like to desplay in on chart category 30 bars. Now my dataset has 12 categories, trying to dispay them in one chart I can see first ten bars and they look nice, but 11 and 12 start overlapping over first and second category bar.
See the example below:
https://dl.dropboxusercontent.com/u/341 ... echart.PNG

Kind regards, Inna

carulla
Posts: 4
Joined: Tue May 20, 2014 8:56 am
antibot: No, of course not.

Re: Amount of categories

Post by carulla » Wed Jun 25, 2014 4:03 pm

Hi, have you tried using a SlidingCategoryDataset? Maybe the solution is to use a scroll :idea:

frambuesa
Posts: 3
Joined: Mon Jun 23, 2014 11:59 am
antibot: No, of course not.

Re: Amount of categories

Post by frambuesa » Fri Jun 27, 2014 7:59 am

Hi David,

I don't think that Slideing will help me much, 'cause my output is a pdf file and this effect will not be handed over. Just a wuestion how many categories can I build in my chart? Ist that possible to build and display in the proper way more than 10 categorie, e.g. 20 categorie in on chart?
Kind regards,
Inna

Locked