0927-0930

Previous Table of Contents Next

Page 927

drill-down relationship for the charts . You define the relationship by selecting the parameter that holds the value for the query. For this chart, select the P_WH_CODE parameter and set it equal to the value of the WH_CODE. Finally, set the drill-down relationship to execute the query for the monthly shipments chart.

Figure 37.11.
Creating a drill-down relationship.


You can test this chart by clicking the Run icon in the Layout Editor. Notice how the monthly chart changes based on the pie segment selected. Save this module as g38oun04.

Creating a Multi-Layer Chart

Another type of multi-chart application is operated by presenting a single chart at a time based on user interaction. To do this, you can create charts on separate layers and coordinate them through the use of buttons or other interface elements. Typically, multi-layer charts are used to display different aspects of related data on separate chart layers. The example that you will create in this section displays the total shipments, average shipping delay, and maximum shipping delay for a given warehouse by month.

To create this display, define the parameters and query to retrieve the data for all three charts in a single query as follows :

 select to_char (to_date (to_char (hist_month_no), `MM', `MON') "Month",      hist_ord_shipped "Shipments",      hist_ship_days / hist_ord_shipped "Average Delay",      hist_max_days "Maximum Delay" from warehouse_history where hist_year = :P_YEAR and hist_wh_code = :P_WH_CODE order by hist_month_no 

In the Layout Editor, create a chart for the total shipments by month. Define this chart as a column chart with shadow as in module g38oun02.ogd. This time, however, before you finish the chart, select the Values tab from the Chart Properties dialog box, as shown in Figure 37.12. In this figure, the available data columns are shown in the left box on the property sheet and the box on the right displays the columns that are used for the chart. Use the Insert and Delete buttons to set up the selection as shown in the figure. Now the chart displays only the monthly shipments.

Page 928

Figure 37.12.
Selecting the value column for a chart.

After you create the first chart, display the layers property sheet for the display by selecting Tools Layers. The Layer Settings dialog (shown in Figure 37.13) manages the layers for a display. Using this dialog box, you can rename, activate, hide, and display the layer. You can also create new layers and delete existing layers.

Figure 37.13.
The Layer Settings dialog.


Using this dialog box, rename the first layer to Ship_layer and create a new layer named Avg_layer. The new layer is automatically activated. Click OK to return to the Layout Editor. At this point, try to select an item from the Monthly Shipments chart on the first layer. Note that nothing from the first layer can be selected because it is not the active layer. Select the Layer Settings dialog box again and click Ship_layer in the Existing Layers box, click the Hide/Show button, and then return again to the Layout Editor. The existing chart is now hidden.

Now, create a new chart that displays the average shipping delay by month. Create this chart on the second layer. Repeat this process to create a third layer named Max_layer and a chart to display the maximum monthly shipping delay. The last step necessary to facilitate navigation between the layers of a chart is to create program units that execute the navigation.

The program units must be assigned to an object, such as a button, in the Graphics display. The first button navigates from the Shipments layer to the Average Delay layer. Using the Layer Settings dialog box, activate the Shipments layer and hide all other layers. To build a button,

Page 929

first select the Text tool and click in the Layout Editor where the button should appear. In the textbox, type Average Delay on two lines. To complete the text entry, click outside the textbox. Next, select the Rounded Rectangle tool and draw a rectangle around the textbox. Using the visual attribute definition buttons at the lower-left corner of the Layout Editor, modify the rectangle to define the color and border that you want. Using Format Bevel from the menu, select a raised bevel effect for the rectangle. Using the Select tool, select the rectangle and the text item and link them as a group object by pressing Ctrl+G. This combined item is called a graphics button.

You should next create a procedure for the button by selecting Tools Properties. The Object Properties dialog box that appears (shown in Figure 37.14) enables you to name the object and assign a button procedure to the object.

Figure 37.14.
The button object property sheet.


After you name the button, click the New button (displayed as Edit in Figure 37.14) next to the button procedure field to create the button procedure. In the PL/SQL editor box, enter the following text for the procedure:

 PROCEDURE OGBUTTONPROC4 (buttonobj IN og_object,                               hitobj IN og_object,                               win IN og_window,                               eventinfo IN og_event) IS        ship_layer    OG_LAYER;        avg_layer     OG_LAYER;      BEGIN        ship_layer := OG_GET_LAYER (`Ship_layer');        avg_layer := OG_GET_LAYER (`Avg_layer');        OG_ACTIVATE_LAYER (avg_layer);        OG_HIDE_LAYER (ship_layer);      END; 

Page 930

Repeat this process by creating buttons on all layers to navigate between the chart layers. When you are finished, save the display as g38oun05.ogd. To test the chart module, click the Run button. When the display appears, click the appropriate buttons to navigate between the separate layers and view the appropriate chart.

Formatting Charts with Text and Breaks

Oracle Graphics provides several optional functions that you can use to customize a chart. These functions include text objects and mechanisms for customizing the labels on a chart. Additionally, if you group data in subcategories , the displays can show data from multiple data sets on the same chart.

Adding Text Items to Charts

You can add boilerplate text to a chart to provide user instructions or additional information on a chart. To demonstrate this function, open the drill-down chart created earlier in module g38oun04.ogd. Add a text object to this chart that instructs the user on how to use the drill-down function of the chart.

Select the Text tool from the tool palette and click in a blank area of the Layout Editor. A textbox appears where you can enter the user instructions. Type Click on any pie segment to view the Monthly Shipments for the selected warehouse. After the text is entered, click outside the textbox to complete the entry.

You can further customize this textbox using the palette controls to define the background fill, outside line color, and color of the text. You can also use the Format menu to define other effects such as font selection and style, text justification, border line thickness , and other attributes. By modifying these attributes, you can customize the text object to provide the effects you want.

Customizing the Chart Labels

Take a look at the shipments chart that you created as the second chart in this chapter. (Refer to Figure 37.7.) The axis labels are based on the columns selected in the query associated with the chart. Under most circumstances, the column names are undesirable for a chart because they do not mean anything to the end user.

Oracle Graphics 2.5 provides two methods for customizing the axis labels for a chart. One way to define the labels is to use the SQL syntax method for creating a column alias directly in the SELECT statement. (This syntax was demonstrated earlier in the multi-layer chart example.)

The other way you can modify the chart labels is to explicitly define the axis labels. To do this, load the monthly shipments chart that was created in the section "Defining Parameters for Charts" earlier in this chapter. Activate the chart in the Layout Editor and select Chart Axes. You use the Axis Properties sheet (shown in Figure 37.15) to define the properties of the chart

Previous Table of Contents Next


Oracle Unleashed
Oracle Development Unleashed (3rd Edition)
ISBN: 0672315750
EAN: 2147483647
Year: 1997
Pages: 391

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net