Tips & Tricks from Arun on JDev ADF, Forms, SQL & PL/SQL.

Wednesday Feb 22, 2012

In normal scenarios, we display the graph and chart to get graphical
representation of data. In this article, we'll see how to create graph
dynamically by dragging the contents from ADF table and dropping on the
graph.

Environment : JDeveloper PS5 (11.1.1.6.0)

Assuming
that we have a table that displays the Department's details. We'll
build a dynamic pie graph to display the Employee details for the
departments that are dragged from the Department's table.

For
our usecase, we need to drag the Departments from Table and Drop it on
the Pie Chart to get the Employees details corresponding to the Depts
selected.

For this, we need to add DragSource in the Dept Table and DropTarget in Emp Chart.

Now that we've added the drag source and drop target, we need to
have a method in our AM/VO's impl class, that take the department number
as input and return the list of employees under it and their details as
ArrayList.

As we need to find out the Departments that are dragged from
table, we'll have a method in the backing bean to get the list of
dragged Departments, iterate through them, pass each to the AM / VO
method created to get Emp details and then construct the ArrayList.

In order to make the Pie Graph use the ArrayList as
source, we need to bind this to the tabularData Property of the pie
graph. Let us also bind the chart to the variable we created in backing
bean and set its dropListener to the method created above. Now, our
pieGraph's source in jspx page would look like