StackedBarChart3D problem with y-axis (number axis)

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Locked
Ranjith
Posts: 8
Joined: Thu Oct 13, 2005 7:34 am

StackedBarChart3D problem with y-axis (number axis)

Post by Ranjith » Tue Oct 25, 2005 12:55 pm

Hi All,

I have to display a status chart using StackedBarChart3D.
I am getting data like this from DB:

Month Assigned Unassigned GateKeeper InProgress Completed
-------------------------------------------------------------------------------------
Aug 0 0 0 0 0
Sep 0 0 0 0 0
Oct 99 0 53 36 3
Nov 0 0 0 0 0
etc...

I am displaying this data using StackedBarChart3D.
the code is:

Code: Select all

LsfuSummary status = (LsfuSummary)request.getAttribute("monthlystatus"); // this atttribute consists the data shown above

  final String[] strMonths = new String[12];
  final int[] strUnassigned=new int[12];
  final int[] strGateKeeper=new int[12];
  final int[] strAssigned=new int[12];
  final int[] strInProgress=new int[12];
  final int[] strCompleted=new int[12];
  final int[] strAllStatus=new int[12];
  
  ProgramSummaryEntry pse=null;
  for(int i=0;i<status.size();i++)
  {
       pse=(ProgramSummaryEntry)status.get(i);
       strMonths[i]=pse.getName();
       strUnassigned[i]=pse.getUnAssigned();
       strGateKeeper[i]=pse.getWithGk();
       strAssigned[i]=pse.getAssigned();
       strInProgress[i]=pse.getInProgress();
       strCompleted[i]=pse.getCompleted();
       strAllStatus[i]=pse.getTotal();
  }

DatasetProducer categoryData = new DatasetProducer() {
   public Object produceDataset(Map params) {
	
	String[] categories = strMonths;
	final String[] seriesNames = { "Unassigned", "GateKeeper", "Assigned", "In Progress", "Completed" };
	final Integer[][] startValues = new Integer[seriesNames.length][categories.length];
	final Integer[][] endValues = new Integer[seriesNames.length][categories.length];
			
     for (int i = 0; i < categories.length; i++) 
    {
        int intTmpVal=0;
        for (int series = 0; series < seriesNames.length; series++) 
       {
	if(series==0)
	{
		startValues[series][i] = new Integer(0);
		endValues[series][i] = new Integer(strUnassigned[i]);
						intTmpVal=strUnassigned[i];
	}
	else if(series==1)
	{
							startValues[series][i] =new Integer(intTmpVal);
	endValues[series][i] = new Integer(intTmpVal+strGateKeeper[i]);
						intTmpVal+=strGateKeeper[i];
	} etc.....
      }
  }
DefaultIntervalCategoryDataset ds =new DefaultIntervalCategoryDataset(seriesNames, categories, startValues, endValues);								
return ds;
}
But Y-axis shows 700 always instead of 191(total of all months)
Can anybody help me out of this? Thanks in advance
Cheers,
Ranjith

angel
Posts: 899
Joined: Thu Jan 15, 2004 12:07 am
Location: Germany - Palatinate

Post by angel » Wed Oct 26, 2005 7:41 am

In your sourcecode I see only specific code and very little jFreeChart. Try to simplify and to reduce your code and post a working example.

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

Post by david.gilbert » Wed Oct 26, 2005 9:41 am

Yes, without a runnable demo of the problem there isn't much we can do to help.
David Gilbert
JFreeChart Project Leader

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

Ranjith
Posts: 8
Joined: Thu Oct 13, 2005 7:34 am

Got the solution

Post by Ranjith » Wed Oct 26, 2005 3:23 pm

Hi David/ Angel,

Thanks for the prompt response. I got a solution.
I am using intTmpVal for y-axis values. It is getting double addition.

I have been asked to do work with other charts, but i have insisted on JFreeChart. It is a good API.

I am asking n suggesting everybody to use JFreeChart. Infact, we are planning to buy Developer's guide.

Can we create Organizational charts (like tree-node) using JFreeCharts?
Cheers,
Ranjith

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

Re: Got the solution

Post by david.gilbert » Wed Oct 26, 2005 4:30 pm

Ranjith wrote:I am asking n suggesting everybody to use JFreeChart. Infact, we are planning to buy Developer's guide.
Thanks. Income from selling the JFreeChart Developer Guide has allowed me to keep working on the project for so long now, so your support is appreciated.
Ranjith wrote:Can we create Organizational charts (like tree-node) using JFreeCharts?
No, JFreeChart can't help with that. But JGraph might help:

http://www.jgraph.com/index.html
David Gilbert
JFreeChart Project Leader

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

Locked