Click OK. Creating a Graph Using Tabular Data

Using ADF Graph Components 24-21

24.6.1.2 How to Control the Number of Different Colors Used for Series Items

The graph stores separate properties such as color for a specific number of series. Beyond that number, the graph repeats series properties. By default, a graph allows up to 30 different series items for which it displays separate properties. The value in the seriesObjectCount attribute of the graph determines the number of series before properties are repeated. If seriesObjectCount is set to the value 4, then series 5 has the same properties as series 1, series 6 has the same properties as series 2, and so on. To control the number of different colors used for series items: 1. In the Structure window, right-click the graph node and choose Go to Properties. 2. In the Property Inspector, in the Appearance attributes category, specify a zero-based value for the seriesObjectCount attribute of the graph.

24.6.1.3 How to Enable Hiding and Showing Series Items

For graph types including area, bar, bubble, combination, line, pie, radar, and scatter, you can enable the hiding or showing of the series in a graph at runtime. Although at least one series must be displayed in the graph, users can filter the display of data values by clicking on the corresponding legend item. To enable hiding and show series items: 1. In the Structure window, right-click the graph node and choose Go to Properties. 2. In the Property Inspector, in the Series section of the Appearance attributes category, set the hideAndShowBehavior attribute of the graph. Valid values include: ■ none: Default value, no hide and show series behavior is enabled. ■ withRescale: Rescales the graph to show only the visible series. ■ withoutRescale: Hides the series, but does not rescale the graph.

24.6.2 Formatting Data Values in Graphs

The attributes in a data collection can be data values or categories of data values. Data values are numbers represented by markers, like bar height, or points in a scatter graph. Categories of data values are members represented as an ordinal axis label, or appear as additional properties in a tooltip. You can format both numerical and categorical attributes by using ADF Faces converter tags, including af:convertNumber for numerical data values, and af:convertNumber, af:convertDateTime, and af:convertColor for categorical data values. Converter tag attributes let you format percents, scale numbers, control the number of decimal places, placement of signs, and so on. For more information about ADF Faces converters, see Chapter 6, Validating and Converting Input.

24.6.2.1 How to Format Categorical Data Values

Categorical data values in graphs are represented by the name in the page definition file pagenamePageDef.xml that defines the graph’s data model. Example 24–4 shows the XML code in a page definition file for a page with a graph displaying categorical data values for the hire date and the bonus cost for employees. 24-22 Web User Interface Developers Guide for Oracle Application Development Framework Example 24–4 Categorical Data Value Names in Page Definition File graph IterBinding=EmpView1Iterator id=EmpView1 xmlns=http:xmlns.oracle.comadfmdvt type=BAR_VERT_CLUST graphDataMap leafOnly=true series data item value=Bonus data series groups item value=Hiredate groups graphDataMap graph For each categorical attribute to be formatted, use the dvt:attributeFormat tag to specify the name of the categorical data value, and specify the child converter tag to be used when formatting the attribute. You can use af:convertNumber, af:convertDateTime, and af:convertColor to specify formatting for a categorical attribute. For example, you can format the hire date and bonus categorical data values defined in the page definition file in Example 24–4 . To format categorical data values defined in a page definition file: 1. In the Structure window, right-click the bar graph tag and choose Insert inside dvt:barGraph ADF Data Visualizations Attribute Format .

2. In the Property Inspector, for the Name attribute, enter Hiredate as the name of

the af1 category attribute. 3. In the Structure window, right-click the attribute format tag you named and choose Insert inside dvt:attributeFormat Convert Date Time.

4. In the Property Inspector, for the Pattern attribute, enter the formatting pattern for

the datetime string conforming to java.text.SimpleDateFormat. For the TimeZone attribute, enter the timezone to interpret any time information in the data string. 5. Repeat Steps 1-4 for the bonus category attribute, setting Bonus as the name of the af2 category attribute, adding an af:convertNumber converter, and formatting the attribute for currency. Example 24–5 shows the XML code that is generated if you format the categorical data values in a bar graph. Example 24–5 Formatting Categorical Data Values in a Bar Graph dvt:barGraph id=barGraph1 value={bindings.EmpView1.graphModel} subType=BAR_VERT_CLUST dvt:attributeFormat id=af1 name=Hiredate af:convertDateTime pattern = yyyy-MM-dd hh:mm:ss a timeZone=USPacific dvt:attributeFormat dvt:attributeFormat id=af2 name=Bonus af:convertNumber type = currency currencySymbol = dvt:attributeFormat dvt:barGraph