Building Charts, Gantts and Maps with Oracle Application Express 4.0

Purpose

This tutorial shows you how to build charts, gantts and maps in Oracle Application Express 4.0.

Time to Complete

Approximately 60 minutes.

Overview

Oracle Application Express 4.0 includes the integration of AnyChart 5.1 resulting in improved performance, decreased rendering time, and decreased update time. In addition to added support for maps and Gantt charts, this release now features scrolling support, interactive labels, markers in legends, multiple data markers, and content menu localization.

Prerequisites

Before starting this tutorial, you should:

Creating a Simple Charting Application

You want to create a simple chart a perform the following steps:

1 .

Enter the following URL in your browser to log in to Oracle Application Express.

http://<yourhostname>:8080/apex

 

2 .

To log in to Oracle Application Express, enter the following details, and click Login.

Workspace: <your workspace name>
Username: <your username>
Password: <your password>

Show Screenshot for Step

 

3 .

From the Oracle Application Express home page, click the down arrow next to Application Builder tab and select Applications > Database Applications.

Show Screenshot for Step

 

4 .

Click Create.

Show Screenshot for Step


5 .

Select Database and click Next.

Show Screenshot for Step

 

6 .

Select From Scratch and click Next.

Show Screenshot for Step

 

7 .

Enter Charting Application for Name and click Next.

Show Screenshot for Step

 

8 .

Make sure Blank is selected for Page Type, enter Home for Page Name and click Add Page.

Show Screenshot for Step

 

9 .

Select the Chart Page Type and specify the following and click Add Page.

Field Value
Subordinate to Page Home (1)
Page Name Sales Report
Chart Type 3D Bar Chart
Chart Title Sales Report
X Axis Title Sales
Y Axis Title Day

Query:

select null link,
to_char(o.order_timestamp, 'DY') label,
sum (decode(p.category,'Accessories',oi.quantity * oi.unit_price)) "Accessories",
sum (decode(p.category,'Mens',oi.quantity * oi.unit_price,0)) "Mens",
sum (decode(p.category,'Womens',oi.quantity * oi.unit_price,0)) "Womens"
from demo_product_info p, demo_order_items oi, demo_orders o
where oi.product_id = p.product_id
and o.order_id = oi.order_id
and (oi.quantity * oi.unit_price) <> 1999
group by to_char(o.order_timestamp, 'DY'), to_char(o.order_timestamp, 'D')
order by to_char(o.order_timestamp, 'D')

Show Screenshot for Step

 

10 .

Click Next >.

Show Screenshot for Step

 

11 .

Accept the default and click Next >.

Show Screenshot for Step

 

12 .

Accept the defaults and click Next.

Show Screenshot for Step

 

13 .

Select an application date format from the list and click Next.

Show Screenshot for Step

 

14 .

Make sure Theme 1 is selected and click Next.

Show Screenshot for Step

 

15 .

Click Create to create the application.

Show Screenshot for Step

 

16 .

Click Run Application.

Show Screenshot for Step

 

17 .

Login to your application and click Login.

Show Screenshot for Step

 

18 .

The Home page is displayed. Select the Sales Report link.

Show Screenshot for Step

 

19 .

The initial report is displayed. You see the Sales Values by day. In the next topic, you want to refine the chart. Select the Edit Page link in the developer toolbar.

Show Screenshot for Step

 

Refining your Chart

You want to make some changes to the chart you just created. Perform the following steps:

1 .

Under Regions > Body (3), right click the region Sales Report and select Edit Chart.

Show Screenshot for Step

 

2 .

Make the following changes and click the Display Settings subtab.

Field Value
Top Margin 10
Bottom Margin 10

Show Screenshot for Step

 

3 .

Make the following changes and click the Axes Settings subtab.

Field Value
Animation Side From Bottom Center
Include on Chart Group By series
Values Rotation 45

Show Screenshot for Step

 

4 .

Change the Y Axis Title to Category and click the Legend Settings subtab.

Show Screenshot for Step

 

5 .

Select Right for Show Legend, enter Category for Legend Title and click Apply Changes.

Show Screenshot for Step

 

6 .

Click Run.

Show Screenshot for Step

 

7 .

Notice that the chart has changed quite significantly. Each category is now grouped by Day so all the sales for each Day within a category are grouped together. Before the sales was grouped by Day. In addition, notice that the values are rotated by 45 degrees.

Show Screenshot for Step

 

8 .

If the diagram has a lot of values, you can turn on the scrollbars. Select the Edit Page link in the developer toolbar.

Show Screenshot for Step

 

9 .

Right click the Sales Report Region and select Edit Chart.

Show Screenshot for Step

 

10 .

Select the Display Settings subtab.

Show Screenshot for Step

 

11 .

Select X-Axis for Show Scrollbars and click Apply Changes.

Show Screenshot for Step

 

12 .

Run the page again. Select the Run Page icon.

Show Screenshot for Step

 

13 .

Notice that there is now a scrollbar on the X-Axis. Move the scrollbar down.

Show Screenshot for Step

 

14 .

Notice that the chart moves as your scroll down. In the next section, you add some resource data so you can create a Resource Gantt chart. Select the Home link in the developer toolbar.

Show Screenshot for Step

 

Adding Resource Information

In order to create the Resource Gantt chart, you need to load some pertanent resource information. Perform the following steps:

1 .

Select the arrow next to SQL Workshop and select Data Workshop under Utilities.

Show Screenshot for Step

 

2 .

Under Data Load, select Spreadsheet Data.

Show Screenshot for Step

 

3 .

Under Load From, select Upload file (comma separated or tab delimited) and click Next.

Show Screenshot for Step

 

4 .

Click Browse...

Show Screenshot for Step

 

5 .

Select the gantt_info.txt file from the directory where your files for this tutorial are located and click Open. Make sure the check box for First row contains column names is checked and click Next.

Show Screenshot for Step

 

6 .

Enter GANTT_INFO for Table Name and click Next.

Show Screenshot for Step

 

7 .

Select Use an existing column for Primary Key From and select Not generated for Primary Key Population and click Load Data.

Show Screenshot for Step

 

8 .

The GANTT_INFO table was created and the data was loaded successfully. In the next section, you will create a Resource Gantt Chart based on this data. Click the Application Builder tab.

Show Screenshot for Step

 

Creating a Resource Gantt Chart

You are now ready to create a resource gantt chart based on the data you just loaded. Perform the following steps:

1 .

Select your Charting Application.

Show Screenshot for Step

 

2 .

You are going to create a new page for the resource gantt chart. Click Create Page.

Show Screenshot for Step

 

3 .

Select Chart and click Next.

Show Screenshot for Step

 

4 .

Select Flash Chart and click Next.

Show Screenshot for Step

 

5 .

Select Gantt and click Next.

Show Screenshot for Step

 

6 .

Select Resource Gantt and click Next.

Show Screenshot for Step

 

7 .

Enter Progress of Tasks Assigned to Employees for both Page Name and Region Name and click Next.

Show Screenshot for Step

 

8 .

Accept the defaults and click Next.

Show Screenshot for Step

 

9 .

Enter Progress of Tasks Assigned to Employees for Chart Title, select Solid Color for Background Type, select a color from the color palette for Background Color 1 (or you can use the color specified in the screenshot #99CCFF), select Look 1 for Color Scheme and click Next.

Show Screenshot for Step

 

10 .

Enter the following SQL and click Next.

select null link, 
       a.emp_id, 
       (select ename from emp where empno = a.emp_id) name,
       parent_id parent_id, 
       a.START_DATE, 
       a.END_DATE 
  from gantt_info a

Show Screenshot for Step

 

11 .

Click Finish to create the page.

Show Screenshot for Step

 

12 .

Click Run Page.

Show Screenshot for Step

 

13 .

The Resource Gantt chart is displayed. You can see when each employee is working on a particular task. In the next section you will load some map data so that you can create a map chart.

Show Screenshot for Step

 

Loading Population Data

Before you create your map, you need to load some population data into your database. Perform the following steps:

1 .

Select the arrow next to SQL Workshop and select Data Workshop under Utilities.

Show Screenshot for Step

 

2 .

Under Data Load, select Spreadsheet Data.

Show Screenshot for Step

 

3 .

Under Load From, select Upload file (comma separated or tab delimited) and click Next.

Show Screenshot for Step

 

4 .

Click Browse...

Show Screenshot for Step

 

5 .

Select the population_info.txt file in the files directory and click Open. Then click Next.

Show Screenshot for Step

 

6 .

Enter POPULATION_INFO for Table Name and click Next.

Show Screenshot for Step

 

7 .

Select Use an existing column for Primary Key From and select Not generated for Primary Key Population and click Load Data.

Show Screenshot for Step

 

8 .

The POPULATION_INFO table has been created and the data loaded. Select the Application Builder tab.

Show Screenshot for Step

 

Creating a Map Chart

You can now create the Map Chart by performing the following steps:

1 .

Select your Charting Application.

Show Screenshot for Step

 

2 .

Select Create Page. Note that you could have created a Map chart region on an existing page.

Show Screenshot for Step

 

3 .

Select Map and click Next.

Show Screenshot for Step

 

4 .

Make sure United States of America is selected and click Next.

Show Screenshot for Step

 

5 .

Expand Country Maps and select States.

Show Screenshot for Step

 

6 .

Enter US State Populations for both Page Name and Region Name and click Next.

Show Screenshot for Step

 

7 .

Click Next.

Show Screenshot for Step

 

8 .

Enter US State Populations for Map Title and click Next.

Show Screenshot for Step

 

9 .

Enter the following SQL and click Next.

select null link, 
STATE_NAME label,
POPULATION value
from POPULATION_INFO

Show Screenshot for Step

 

10 .

Click Finish.

Show Screenshot for Step

 

11 .

Click Run Page.

Show Screenshot for Step

 

12 .

The chart is displayed. Place your cursor on one of the states to see the population for the state.

Show Screenshot for Step

 

13 .

Select the Zoom + icon to zoom into the map.

Show Screenshot for Step

 

14 .

Notice that when the map is closer you see the population values in the map. You can also modify some of the display settings to change the way the map looks. Select the Edit Page link in the developer toolbar.

Show Screenshot for Step

 

15 .

Right click the US State Populations region and select Edit Chart.

Show Screenshot for Step

 

16 .

Select the Display Settings subtab.

Show Screenshot for Step

 

17 .

Click No Lines for Show Grid and select the Eckert 3 Map Projection and click Apply Changes.

Show Screenshot for Step

 

18 .

Click the Run Page icon.

Show Screenshot for Step

 

19 .

Notice that the map no longer has lines and the projection is slightly different. You can experiment with the different settings.

Show Screenshot for Step

 

Summary

In this tutorial, you have learned how to:

Hardware and Software Engineered to Work Together About Oracle |Oracle and Sun | Oracle RSS Feeds | Careers | Contact Us | Site Maps | Legal Notices | Terms of Use | Your Privacy Rights