In this blog I would try to show how you can play around with one of the Oracle ADF’s Data Visualization Tool (DVT) Bar Graph. Initially it seems so tough to come up with a graph component and ofcourse making it dynamic so that it displays graph based on current data. [I would be using default HR schema from the Oracle Database.]
1. Let’s start with creating a Model and ViewController project.
2. In your model project we would be creating View Object’s (either an Entity Based or SQL based, since we may not be updating the data through graphs a SQL based View Object could be efficient) which would be acting as source for the graphs. I would be creating SQL based View Object in this entire demo.
3. Create an Application module with name say ‘AppModule’, this would be used to expose all the view objects to client as Data Control.
4. Right Click on the ViewController project and click ‘New’. In the New Gallery dialog, select ‘JSF’ under Categories and then select JSF Page under items and click ok.
5. In Create JSF Page dialog, provide a file name ‘DemoDVT1’, make sure ‘Create as XML Document (*.jspx)’ is checked and click ok.
Graph 1: Salary Vs Employee
6. Create a View Object with the SQL and name it as SalaryVsEmployeeVO.
Select Ename, Sal from EMP
7. Add this VO to Application Module AppModule.
8. Drag the SalaryVsEmployeeVO from the DataControl and drop to the jspx DemoDVT1 as Graph.
9. In Component Gallery for the graphs, select ‘Bar’ as Categories for Bar Graph, select Graph Type and a Quick Start Layout and click OK.
10. In Create Bar Graph wizard drag and drop ‘Sal’ into the Bars input box. You can also select the same from the green ‘+’ sign. Also drag ename column into the X axis input box.
11. Optionally you can click on the Preview Tab to see how the outcome will look like.
12. Once done just run the DemoDVT1.jspx page to see the graph which would look similar to one below (there could be some difference based on the data in the EMP table).
13. This is how you can proceed with working with Bar graph in Oracle ADF.
I will continue further on the use of Bar Graph in next part.