248 total views, 1 views today

Create an ADF Gantt Chart Programmatically – Project Gantt

ADF Gantt Chart is a type of chart shows table on the left-hand side and its associated bar on right side. Each bar is a visual representation of a table row. The Gantt Chart is widely used in Project management to represent task against time. If you see on the below Project Gantt chart, there is Time axis on top of the bar chart.

 

From the Gantt Chart, user can understand,

1. When each task begins and end,

2. Status of the task like started, in progress, completed.

3. Type of task like normal, milestone or summary task

4. CPM analysis, edit the schedule and more

 

Oracle ADF Gantt Chart

 

Oracle ADF provides three different types of Gantt Chart. They are Project, Resource, and Schedule chart. This section we are covering the Project Gantt Chart. Below are some key points required to create a Project Gantt Chart

1. Project Gantt is simply a collection of Tasks. A task requires three mandatory fields; they are TaskId, StartTime, and Endtime. The minimal requirement to create a Project Gantt Chart is a Task object with these three properties

2. The Project Gantt supports both Collection and Tree model. Collection model is for showing Task in list view, and tree model is for Hierarchical view. We used tree model in this example.

3. Use the Java interface oracle.adf.view.faces.bi.model.ProjectTask for all the supported properties to create a Task object. In the below chart, a bar represents a task object

4. The Task in Project Gantt supports three important properties. They are

  • Dependency: Used to create Relationship between tasks. The arrow between the two bar represents the relationship. Supported dependencies are fs (Finish-Start), sf (start-Finish), ss (Start-Start), ff (Finish-Finish). Use the Java interface oracle.adf.view.faces.bi.model.Dependency for the supported properties to create a Dependency object.

 

  • SubTask: A Task can have one or more sub task. Use the same Java interface ProjectTask for properties.

 

  • SplitTask: A task can be split into many. Use the Java interface oracle.adf.view.faces.bi.model.SplitTask for the supported properties to create SplitTask object

 

The below image is the final output of the Project Gantt that we are going to create.

 

010517_0338_CreateanADF1 Create an ADF Gantt Chart Programmatically - Project Gantt

 

The following steps are required to create a Project Gantt chart with dependencies programmatically 

1. Create a Dependency Bean class

2. Create a Task Bean Class

3. Construct the Project Gantt using the above bean classes

4. Use the ADF Tree Model to return the object to JSF

5. Render Project Gantt Chart with the tree model object

Let’s begin the example

 

ADF Project Gantt Chart with Dependencies Programmatically:

 

1. Create an ADF Fusion Web Application

 

2. Create a package in view controller and Create a JSF page with backing bean class

 

3. Create a Dependency  Bean class by implementing interface oracle.adf.view.faces.bi.model.Dependency. Though the interface is not mandatory, it helps to identify the supported properties with correct variable names.

 

 

4. Create a Task Bean class by implementing Oracle.adf.view.faces.bi.model.ProjectTask. I have added a method & List object other than setter & getter methods. Add any additional property if you want to display it on the Gantt Chart table. 

List<ProjectGanttBean> project => To support Task in Hierarchical representation

addDependancy(Dependency dep) => To add a dependency to a Task

 

 

5. Construct a Project Gantt Chart using the above bean classes in backing bean and add the final object to the ChildPropertyTreeModel. The JSF page refer this object to display Gantt Chat

 

 

 

6. Open the JSF page and add the <dvt:projectGantt inside the form tag as shown below

010517_0338_CreateanADF2 Create an ADF Gantt Chart Programmatically - Project Gantt

 

7. Optionally, add <dvt:ganttLegend. Open the structure panel; Right click on the dvt:projectGantt, Insert Inside Project, ADF Data Visualizations, Legend.

010517_0338_CreateanADF3 Create an ADF Gantt Chart Programmatically - Project Gantt

 

8. Bind the ‘value’ property to the object of ChildPropertyTreeModel in backing bean class. Add the needed columns and bind the value to the bean properties.

 

 

9. Run the JSF page will give the following output

010517_0338_CreateanADF4 Create an ADF Gantt Chart Programmatically - Project Gantt

 

Download Project: ADF Gantt

govindan Create an ADF Gantt Chart Programmatically - Project Gantt
Connect me

Govind

Thank you for visiting my personal blog. Myself Govindan, Software Developer by profession since 2006 and hence I started this blog early in 2016 and ever since I've been writing about technologies experienced and learnings of everyday life.

The views expressed on this blog are my personal views and do not necessarily reflect the views of my employer.

Please feeling free to reach me on any comments and feedbacks you have. Would be more than glad to listen and reply 🙂
govindan Create an ADF Gantt Chart Programmatically - Project Gantt
Connect me
  • Kavinkumar

    hi
    i want to know how to export pivot table as PDF

    • Govindan Padmanaban

      Currently ADF supports only excel type format. The only supported value is excelHTML.

Like us on Facebook.
Connect!