Skip to Main Content

Java Programming

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Creating a Stacked Bar Graph(JFreeChart) using specific data

807603Nov 26 2007 — edited Nov 26 2007
I 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
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Dec 24 2007
Added on Nov 26 2007
6 comments
633 views