Representing categories inside other categories

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Locked
Badredin
Posts: 5
Joined: Wed Feb 10, 2016 3:14 pm
antibot: No, of course not.

Representing categories inside other categories

Post by Badredin » Thu Feb 11, 2016 7:27 am

Hello,

I'm trying to represent category data inside other categories. For example, I have category CAT1 which will group subcategories SCAT1, SCAT2 etc and each subcategory will have two values represented by two bars.

One option which I'm trying to make it work is to use a different CategoryPlot for each category CAT1, CAT2 etc. and plot each subcategory in its corresponding plot. Unfortunately, when there are many categories the subplots are shrunk. I have posted about this problem here: viewtopic.php?f=3&t=117511.

I was wondering if there is another way to represent the kind of chart I described. Any ideas?

Thanks

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

Re: Representing categories inside other categories

Post by david.gilbert » Fri Feb 12, 2016 5:39 am

The SubCategoryAxis class can be used for this. There is an example in the JFreeChart demo collection that comes with the JFreeChart Developer Guide. There's also some info in this older post:

http://www.jfree.org/phpBB2/viewtopic.php?f=3&t=109536
David Gilbert
JFreeChart Project Leader

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

Badredin
Posts: 5
Joined: Wed Feb 10, 2016 3:14 pm
antibot: No, of course not.

Re: Representing categories inside other categories

Post by Badredin » Fri Feb 12, 2016 7:15 am

Thank you David! I'll give it a try.

Badredin
Posts: 5
Joined: Wed Feb 10, 2016 3:14 pm
antibot: No, of course not.

Re: Representing categories inside other categories

Post by Badredin » Fri Feb 12, 2016 10:41 am

Hello,

I tried the SubCategoryAxis but it seems that this class is used to assign labels to subcategories. I wasn't able to create e.g. 2 bars for each subcategory since the DefaultCategorySet assigns the values to categories. Is it possible to assign values to subcategories directly?

Locked