Hi,
I have 2 stacked bar graphs that I would like to display side-by-side, i.e. in the same category. I know how to do each one separately, but not together. Seems like the data for the rows is interpreted differently when doing a normal bar graph vs. a stacked bar graph.
Any help/suggestions would be appreciated. Thanks in advance!
-los
multiple stacked bar graphs in same category
-
- Posts: 6
- Joined: Tue May 04, 2004 9:06 pm
-
- JFreeChart Project Leader
- Posts: 11734
- Joined: Fri Mar 14, 2003 10:29 am
- antibot: No, of course not.
- Contact:
Grouped stacked bar charts will be supported in the 0.9.19 release (or you can try out the code now in CVS).
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
-
- Posts: 6
- Joined: Tue May 04, 2004 9:06 pm
Hi David,
Thanks for the tip. I just retrieved the code from CVS and did a successful build. When I run my existing code, I get the following error:
/////////////////////////////////////////////////////////////////////
java.lang.NoSuchMethodError: org.jfree.util.Log.createContext(Ljava/lang/Class;)
Lorg/jfree/util/LogContext;
at org.jfree.chart.axis.Axis.<clinit>(Axis.java:170)
at org.jfree.chart.ChartFactory.createStackedBarChart(ChartFactory.java:
......
/////////////////////////////////////////////////////////////////////
I verified this by checking out the LogContext class and that method does not exist.
-los
Thanks for the tip. I just retrieved the code from CVS and did a successful build. When I run my existing code, I get the following error:
/////////////////////////////////////////////////////////////////////
java.lang.NoSuchMethodError: org.jfree.util.Log.createContext(Ljava/lang/Class;)
Lorg/jfree/util/LogContext;
at org.jfree.chart.axis.Axis.<clinit>(Axis.java:170)
at org.jfree.chart.ChartFactory.createStackedBarChart(ChartFactory.java:
......
/////////////////////////////////////////////////////////////////////
I verified this by checking out the LogContext class and that method does not exist.
-los
-
- Posts: 6
- Joined: Tue May 04, 2004 9:06 pm
Well, I "fixed" the bug in the CVS source and tried to do a grouped stacked bar chart but to no avail. What I did was create two CategoryDatasets (the stacked data), created two StackedAreaRenderers, one for each stacked dataset, created a CategoryPlot, and then added each dataset with respective renderer to the plot. When I created a JFreechart from this plot and displayed it, I get a really weird looking graph. Any suggestions on how to actually use the grouped stacked bar feature? Thanks!
-los
-los
Hi,
these classes belong from JCommon package. As you just retrieved the code from the CVS, you have retrieved all JCommon files in the same time (JCommon files are a part of JFreeChart classes).
I have just check that in last JCommon "binary" (JCommon-0.9.3) the function createContext from org.jfree.util.Log does not exist, but it exists in the class comming from the CVS.
The line below (from the README.txt from jcommon directory of JFreeChart) could have put us on the picture about this matter too:
So (yes, i will answer ), i think that you just have to remove the jcommon package from your classpath and all will be okay (i guess java loads the first comming in order)
Bye,
Mimil
PS: let me know if it was that
these classes belong from JCommon package. As you just retrieved the code from the CVS, you have retrieved all JCommon files in the same time (JCommon files are a part of JFreeChart classes).
I have just check that in last JCommon "binary" (JCommon-0.9.3) the function createContext from org.jfree.util.Log does not exist, but it exists in the class comming from the CVS.
The line below (from the README.txt from jcommon directory of JFreeChart) could have put us on the picture about this matter too:
because you have retrieved JFreeChart 0.9.19.0.9.3 : (15-Apr-2004) Update to coincide with JFreeChart 0.9.18.
So (yes, i will answer ), i think that you just have to remove the jcommon package from your classpath and all will be okay (i guess java loads the first comming in order)
Bye,
Mimil
PS: let me know if it was that
Last edited by Mimil on Tue May 18, 2004 9:32 pm, edited 1 time in total.
-
- Posts: 6
- Joined: Tue May 04, 2004 9:06 pm
Hi Mimil,
Yes, that was it. As I previously posted, I did "fix" this up so that it does not read from the old jcommons. Now I'm stuck with my original problem of grouping together stacked bar charts... Any ideas on how to do this with the new code?
As I mentioned before, I tried using a StackedAreaRenderer (this was one of the classes documented to have added grouped stacked bar charts as a new feature)... but got nowhere with it.
Again, any help/suggestions would be appreciated. Thanks in advanced!
-los
Yes, that was it. As I previously posted, I did "fix" this up so that it does not read from the old jcommons. Now I'm stuck with my original problem of grouping together stacked bar charts... Any ideas on how to do this with the new code?
As I mentioned before, I tried using a StackedAreaRenderer (this was one of the classes documented to have added grouped stacked bar charts as a new feature)... but got nowhere with it.
Again, any help/suggestions would be appreciated. Thanks in advanced!
-los
-
- JFreeChart Project Leader
- Posts: 11734
- Joined: Fri Mar 14, 2003 10:29 am
- antibot: No, of course not.
- Contact:
Mimil is correct, you need to build the latest JCommon as well. The source files are in the same CVS repository as the JFreeChart code - it all needs sorting out. You can run the 'ant -f ant/jcommon.xml' if you want to build a new jcommon.jar file, or just compile all the JFreeChart/JCommon source files together (which is what I do while I'm working on the code).
StackedBarChartDemo4.java provides an example for the new GroupedStackedBarRenderer class.
StackedBarChartDemo4.java provides an example for the new GroupedStackedBarRenderer class.
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