Creating a Stacked Bar Graph(JFreeChart) using specific data
807603Nov 26 2007 — edited Nov 26 2007I am trying to create a stacked bar graph using JFreeChart.
The graph is for Project Management related data (Resource Workload) with the following details:
X-Axis : january, February, March etc (i.e months of the year) <- problem
Y-Axis : Hours
Legend: 'allocated' and 'unallocated'
Each stack represents the allocated And unallocated hours per month.
I tried the following:
private void doGraph4(){
// create a dataset...
Double[][] data = new Double[][]
{{new Double(150), new Double(20)},
{new Double(250), new Double(50)}};
// x-axis
String[] months = new String[] {"January", "February", "March", "April", "May", "June"};
String[] legend = new String[] {"Allocated", "UnAllocated"};
CategoryDataset datasetWorkload = DatasetUtilities.createCategoryDataset((months, legend, data);
// create the chart...
barStackedGraph = ChartFactory.createStackedBarChart3D(
"Workload (Programmer)", // chart title
"Month",
"Hours",
datasetWorkload, // data
PlotOrientation.VERTICAL,
true,
true,
true
);
:
:
}
Awaiting your reply.
Appreciate your time.
Thank you.
-mn