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.
Amount of categories
-
- JFreeChart Project Leader
- Posts: 11734
- Joined: Fri Mar 14, 2003 10:29 am
- antibot: No, of course not.
- Contact:
Re: Amount of categories
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.
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
Read my blog
Support JFree via the Github sponsorship program
JFreeChart Project Leader
Read my blog
Support JFree via the Github sponsorship program
Re: Amount of categories
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
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
Re: Amount of categories
Hi, have you tried using a SlidingCategoryDataset? Maybe the solution is to use a scroll
Re: Amount of categories
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
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