330 likes | 462 Views
Enhanced Guide to Oracle8i. Chapter 10: Using Graphics Builder. Graphics Builder. Developer utility used for creating graphical displays of database data All labels and values that appear on charts is retrieved from the database. Chart Types. Column
E N D
Enhanced Guide to Oracle8i Chapter 10: Using Graphics Builder
Graphics Builder • Developer utility used for creating graphical displays of database data • All labels and values that appear on charts is retrieved from the database
Chart Types • Column • Shows discrete values using vertical columns • Bar • Shows discrete values using horizontal bars • Gantt • Shows task or project scheduling information using horizontal bars
More Chart Types • High-Low • Shows multiple Y-axis values for each X-axis point • Line • Shows data values as points connected by lines to show trends • Mixed • Combines a column and line chart
More Chart Types • Pie • Shows how individual data values contribute to an overall total • Scatter • Plots 2 sets of potentially related data to identify possible trends • Table • Shows text data in a table
More Chart Types • Double-Y • Shows a column or line chart with multiple values for the same X-axis value
Creating a Chart • Use the Chart Genie to: • Specify the SQL query to retrieve the chart data from the database • Select the chart type • Define the chart display properties
Specifying Chart Queries • Chart query must return all data that appears on the chart • Pie chart • pie slice labels • numerical values corresponding to each pie slice • Bar chart • X- and Y-axis labels • numerical values corresponding to each bar value • Line chart • X- and Y-axis labels • numerical values corresponding to each line value
Specifying Chart Queries • When using SQL group functions (SUM, AVG, MIN, MAX) for chart data, assign a column alias Group function Column alias
Defining Chart Properties • Chart Name • How chart is referenced internally • Title • Chart type • Column, bar, pie, etc. • Chart subtype • Formatting and display features for selected chart type
Chart Properties Dialog Box • Chart tab Chart types Chart subtypes
Data Tab • Enables you to edit the SQL query Click Edit to edit SQL query
Categories Tab • Defines the labels that appear on the chart Available label fields (data fields from query) Selected label fields
Values Tab • Specifies the numerical data field(s) that are displayed Available data fields (numerical data fields from query) Selected data field
Formatting the Chart Display • Frame Properties dialog box • Used to format the chart frame area • Show/Hide legend • Show percentages on pie charts
Applying Format Masksto Chart Data Fields • Select the field on the chart display • Select or add a format mask • Format masks can only be applied to NUMBER and DATE fields
Chart File Types • Design (.ogd) files • Can be viewed and modified in Graphics Builder • Displayed in Graphics Debugger window • Executable (.ogr) files • Finished application viewed by users • Displayed in Graphics Runtime window
Integrating Charts and Forms • Approaches • Create the form, then call the chart as a separate application • Display the chart directly on the form
Creating a Form That Calls a Chart Value selected on form determines values displayed on chart
Calling a Chart From a Form • Create parameter(s) in the chart query to accept input parameter(s) from the form • Create a parameter list in the form to pass the input parameter(s) from the form to the chart • Run the chart from the form using the RUN_PRODUCT procedure
Creating a Parameter in theChart Query • Substitute one or more search conditions in the report SQL query with a parameter name prefaced with a colon (:) parameter
Creating a Parameter List • Declare the parameter list variable in the DECLARE section of the trigger that calls the chart • Create the list declaring the list bind parameters creating the list
Adding Parameters to the Parameter List • Parameter lists can only pass character or record group data • Add parameters to the parameter list using the ADD_PARAMETER procedure: ADD_PARAMETER(list_id, key, paramtype, value); • List_id: ID of the parameter list • Key: name of the parameter in the report • Paramtype: values can be TEXT_PARAMETER (for character values) or DATA_PARAMETER (for record groups) • Value: data value to be passed in parameter list
Example of the ADD_PARAMETER Procedure List Key Paramtype Value
Running the Chart Using theRUN_PRODUCT Procedure RUN_PRODUCT(product, document, communication_mode, execution_mode, location, parameter_list_id, display); • Product: application to run • REPORTS or GRAPHICS • Document: complete path and filename to chart .ogd file • Communication mode • SYNCHRONOUS: control returns to the form only after chart is closed • ASYNCHRONOUS: user can toggle between chart and form
Running the Chart Using theRUN_PRODUCT Procedure RUN_PRODUCT(product, document, communication_mode, execution_mode, location, parameter_list_id, display); • Execution_mode • RUNTIME: called product's runtime environment is started • BATCH: called product is displayed directly on the form • Location • FILESYSTEM: chart file stored in the filesystem • DATABASE: chart file stored in the database • Parameter_list_id: ID of the parameter list to be passed • Display: name of the graphic image object on the form; only used when displaying a chart directly on a form canvas • Value is NULL when displaying a chart in the Graphics Runtime window
Example RUN_PRODUCT Procedure Product Document Communication Mode Location Execution Mode Parameter List ID Display
Creating a FormWith an Embedded Chart • Create a data block form that contains the data that will appear in the chart • Use the Chart Wizard to create the embedded chart • Edit the chart formatting as necessary in Graphics Builder
Use the Chart Wizard to Specify: • Chart title, type, and subtype • Form data block that is the source of the chart data • Data fields that specify the data for the chart Category and Value data • The name of the file that stores the chart .ogd file
Formatting the Chart Created by the Chart Wizard • Open the chart .ogd file in Graphics Builder • Edit the chart properties • Size • Font types • Legend display • Colors • Label format masks
Creating a Report With an Embedded Chart • Create a report that contains the data that will appear in the chart • Use the Chart Wizard in Report Builder to create the chart • Modify and resize the chart in Report Builder • Chart must be in same repeating frame as its source data columns • Format the chart in Graphics Builder if necessary