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;
}
Can anybody help me out of this? Thanks in advance