In this tutorial, you learn how to create and customize a graph using the Graph Wizard.
Approximately one hour
This tutorial covers the following topics:
Overview | ||
Scenario | ||
Prerequisites | ||
Defining the Data Model | ||
Customizing a Graph | ||
Generating Report Output to a PDF File | ||
Summary | ||
Related information |
Place the cursor over this icon to load and view all the screenshots for this tutorial. (Caution: Because this action loads all screenshots simultaneously, response time may be slow depending on your Internet connection.)
Note: Alternatively, you can place the cursor over each individual icon in the following steps to load and view only the screenshot associated with that step.
You can add a variety of charts and graphs, including true three-dimensional graphs, to a report using the Graph Wizard.
In this tutorial, you will create a report that contains just a graph—a pictorial representation of data. You will begin by defining the data model for the graph, and then creating the graph in the Paper Layout view of the Report Editor using the Graph Wizard. You will learn how to customize the look and feel of the graph and finally, generate PDF output for your report.
The graph that you create in this tutorial displays the average price and quantity for orders that are ready for shipment. The graph is based on the Order Entry data model.
Before starting this tutorial, you should:
1. |
Have access to or have installed Oracle Reports Developer . |
2. |
Have access to or installed the sample schema. This tutorial uses the OE schema included in the Oracle10g database. |
3. | Download reportsOBE.zip and unzip into your working directory. |
Before you can create a graph, you need to identify the data that the graph will display. Begin by creating a new report.
1. |
If it is not already open, start Oracle Reports by clicking the Reports Builder icon on your desktop. The welcome screen displays. Select the option Build a new report manually. Click OK. If Reports Builder is already open, create a new report by selecting File > New > Report from the menu. Select the option Build a new report manually. Click OK. In both cases, the Data Model view of the Report Editor displays.
|
2. | The Data Model view is a work area in which you create, define, and modify data model objects to be used in your report. Data model objects include queries, groups, columns, parameters, and links. Reports Builder uses the data model to determine what data to retrieve for the report. For this lesson, you will define a SQL query. Locate the SQL Query icon in the tool palette. Select the tool by clicking it, and then click the Data Model canvas. This action invokes the SQL Query Statement dialog box.
|
3. | Click Connect to connect to the database. In the Connect dialog box, enter OE for the User Name, OE for the Password, and the name of your database for the Database field. Click Connect. Note: If you were previously working in this Reports Builder session using a different schema, you will have to connect to the OE schema in order to complete this tutorial.
|
4. | You can now type in a SQL statement, define a query visually using Query Builder, or import an existing file. For your convenience, a SQL query is provided for you. Click Import Query. In the file import dialog box, click Simple_Graph.sql located in the your working directory. Click Open. The contents of the query are pasted into the Query dialog box.This query uses group functions to retrieve the average price and quantity of items in a number of customer orders. Click OK. Note that Reports Builder symbolically represents the query in the Data Model view.
|
Now you will switch to the Paper Layout view of the Report Editor to create the graph. The Paper Layout view is a work area in which you can modify the format of your paper report. The default format for your report is defined by the information you specify in the Report Wizard. You can modify the format by working with layout objects, such as frames, repeating frames, fields, boilerplate, anchors, and graph objects. In this view, objects and their property settings are represented symbolically to highlight their types and relationships.
You will add a graph object to the paper layout and use the Graph Wizard to define your graph.
1. |
Locate and click the Paper Layout icon on the toolbar across the top of the Report Editor window. The Paper Layout view of the Report Editor displays.Notice that the view is empty, as you did not use the Report Wizard to create this report.
|
2. | Next, you will add a graph to the paper layout. Select Insert > Graph from the Menu. The Welcome page of the Graph Wizard displays.Click Next.
|
3. | Choose the type of graph you want to create. The Graph Wizard offers several primary graph types with which to represent data, such as bar, line, and pie graphs. In addition, the wizard provides special usage graphs that are associated with particular data types or ways to display unique cases of data. These types include scatter, bubble, and stock graphs. For this tutorial, use the default graph type, a Bar graph, to represent your data.Click Next.
|
4. | Choose the placement of the graph in your report. Select at the beginning of the report and click Next .
|
5. | Now select the category column(s) for the X-axis of your graph. The X-axis is the horizontal axis and can contain groups as well as items. For this tutorial, select ORDER_ID as the X-axis. Use the arrow button [>] to move ORDER_ID to the X-Axis Categories list. Click Next. |
6. | On the next panel of the wizard, you specify options for the data axis of your graph. The Y-axis is the vertical axis and contains data columns. The data columns must contain numeric data. Select both the AVG_UNIT_PRICE and AVG_QUANTITY columns and move them to the Y-Axis Categories list by using the arrow button [>]. Click Next.
|
7. | You are now viewing the Layout panel of the Graph Wizard. Here, you can rearrange the data in your graph to control the way the data will be displayed. Ensure that ORDER_ID is in the Groups field. The Groups field specifies the data items for the groups of the graph. On a bar graph, a group is a cluster of bars. Click Next.
|
8. | On the Title panel of the wizard, you can specify text and font attributes for the title, subtitle, and footnote of your graph. Enter the text string Orders in the Title field for this graph. Include a footnote for your graph by entering the text string Source: Order Company, Inc. in the Footnote field. Click Next to advance to the Legend panel of the Graph Wizard.
|
9. |
You use the Legend panel to select display options for the legend of your graph. The legend area is a place on the graph that provides a key to the information that is shown in the graph. For this tutorial, keep the default settings and click Next .
|
10. | You can now select options for the X-axis of your graph. Specify a title of Order ID for the X-axis. Select the radio button Show labels for all tick marks on the X-axis. Click Next.
|
11. | Similarly, you can specify options for the Y-axis of your graph. Specify a title of Average Price and Quantity for the Y-axis and click Next.
|
12. | You can use the Plot Area panel of the Graph Wizard to specify how the plot area of your graph should be displayed. Options include grid lines, line color and style for grid lines, data tables, and data tips. Data tips are tooltips that display when the mouse is moved over a bar, pie slice, and so forth. For this tutorial, keep the default options and click Next.
|
13. | The final panel of the Graph Wizard allows you to specify a hyperlink value to enable you to link areas of the graph with specific destinations. Leave the hyperlink value field blank for this tutorial and click Finish to complete the definition of your graph. Your graph is represented by a graph object in the Paper Layout view of the Report Editor. Using the rulers in the Paper Layout, resize the graph object to an approximate width of 6 inches, and a height of 4 inches. To do this, select one of the object handles and drag it horizontally, or vertically, until the object is sized appropriately.
|
14. | View the paper layout of your report by clicking the Run Paper Layout icon on the toolbar, or by selecting Program > Run Paper Layout from the menu. Your output displays in the Paper Design view of the Report Editor.
|
15. | Save your report as OrdersGraph_< your_initials >.jsp. To save a report definition, click the Save icon in the toolbar , or select File > Save from the menu. The first time you save your report definition, the Save dialog box displays, giving you the opportunity to enter a meaningful name for your report. Click Save.
|
The wizards in Reports Builder are reentrant. Once you have defined a graph, you can reenter the Graph Wizard to modify the graph settings and customize the graph to your requirements. In this section of the tutorial, you will customize the look and feel of the graph in your Orders Report.
1. |
With your graph displayed in the Paper Design view, right-mouse-click on the graph and select Graph Wizard from the menu.
|
2. |
Notice that each panel in the Graph Wizard is displayed on a tab. This enables you to navigate directly to the panel you want to modify by simply selecting the corresponding tab, rather than having to click ‘Next' to move through each panel in turn. Modify the graph type. Select the Type tab. Note that the Bar type has several subtypes. Select the Dual-Y Bar subtype. In addition, select the 3D effect check box.
|
3. | Next, select the Legend tab. Choose a Border color for the legend in your graph.
|
4. | Select the Plot Area tab. Eliminate the vertical grid lines in your graph by clearing the Show Vertical Grid lines check box.
|
5. | Choose a color for the horizontal grid lines.
|
6. | Optionally, you can modify the color of the bars in the Series field.
|
7. | When you are done customizing the Plot Area, click OK . Your customized graph displays in the Paper Design view of the Report Editor. Save your report by clicking Save in the toolbar.
|
Reports Builder can generate report output to a PDF file, containing the formatted data and all objects. When you generate your report output to a PDF file, you can distribute the output to any PDF destination, including e-mail, printer, OracleAS Portal, and Web browser.
1. |
Select the report in the Object Navigator.
|
2. | Select File > Generate to File > PDF from the menu. Save your report output as OrdersGraph_<your initials>.pdf , such as OrdersGraph_eg.pdf.
|
In this lesson, you've learned how to:
Define a data model | ||
Create and customize a graph using the Graph Wizard | ||
Generate report output to a PDF file |
To learn more about Oracle Reports 10g, refer to the additional Reports OBEs. | ||
Visit the OTN Web site for technical papers, presentations, frequently asked questions, demonstrations, and more. |
Place the cursor over this icon to hide all screenshots.