How to Customize the Overall Appearance of Pie Graphs

24-40 Web User Interface Developers Guide for Oracle Application Development Framework dvt:scatterGraph markerColor=Product markerShape=City value={bindings.View1.graphModel}

24.8 Adding Specialized Features to Graphs

There are graph customization features that include the ability to define series-related reference lines and axis-related reference areas, the option of adding gradient special effects to several parts of a graph, the option of setting some parts of a graph to transparent colors, and the use of alerts and annotations in graphs. These special features also let you use interactive capabilities of the graph.

24.8.1 Adding Reference Lines or Areas to Graphs

Reference lines and areas can be set to display always, on rollover only, or never, regardless of how many there are and whether they are associated with a series or an axis. You can create reference lines that are associated with a series that is a set of data values that appears as a single color in the graph legend. If there are multiple series with reference lines, then the reference lines show only when you move the cursor over a series marker or the corresponding series legend item. This is because multiple reference lines can be confusing to users. You can also create reference areas that are associated with an axis. Typically, these areas are associated with a y-axis. If there are multiple reference areas, then these areas are also displayed when you move the cursor over the related axis. If your application does not know how many reference lines or areas it will need until it is running, then you can create reference lines or areas dynamically at runtime.

24.8.1.1 How to Create Reference Lines or Areas During Design

Both reference lines and reference areas are created by the use of the following tags: ■ dvt:referenceObjectSet: Wraps all the reference object tags for reference lines or reference areas for this graph. ■ dvt:referenceObject: Identifies whether the tag represents a reference line or a reference area and specifies characteristics for the tag. To add reference lines or areas to a graph during design: 1. In the Structure window, right-click the graph node and choose Insert inside dvt:typeGraph ADF Data Visualization Reference Object Set. 2. If you are defining reference areas related to specific axes, then specify a value for the appropriate axis or axes attributes: displayX1, displayY1, or displayY2. The value RO_DISPLAY_AUTOMATIC enables the display of a reference area only when the mouse moves over the related axis. This choice prevents the confusion that might occur if multiple reference areas were displayed all the time. Optionally, you can apply a gradient special effect to the reference area. For more information see Section 24.8.2.1, How to Add Gradient Special Effects to a Graph. 3. In the Structure window, right-click the dvt:referenceObjectSet node and choose Insert inside dvt:referenceObjectSet Reference Object. 4. In the Property Inspector, do the following: Using ADF Graph Components 24-41 a. In the Common attributes category, specify values for the index attribute of the reference object, the type attribute of the reference object RO_LINE or RO_AREA, the associated object in the association attribute a series for a reference line or a specific axis for a reference area. Also specify if the object should be displayed in the legend using the displayedInLegend attribute, and specify the text, if any, to display in the legend. b. If you are creating a reference line, then specify values for the attributes related to the line. This includes specifying the series number of the series to which the line is related. The series number refers to the sequence in which the series appear in the Graph data binding dialog. c. If you are creating a reference area, then specify the low value and the high value that represent the reference area on the specified axis.

5. In the Structure window, right-click the graph node and choose Go To Properties.

6. In the Property Inspector, select the Appearance attributes category and do the

following to control the display of reference lines and reference areas: a. If you have defined reference lines which must be related to a series, then expand the dvt:series node and specify a value for the behavior of the displaySeries attribute. The value RO_DISPLAY_AUTOMATIC enables the display of a reference line only when the cursor moves over a series item such as a bar or over the corresponding series entry in the graph legend. This choice prevents the confusion that might occur if multiple series reference lines were displayed all the time. b. If you have defined reference areas which must be related to specific axes, then associate the reference object with the appropriate axis or axes.

24.8.1.2 What Happens When You Create Reference Lines or Areas During Design

When you create reference lines or areas during design, XML code is generated within the graph XML on the JSF page. The reference objects both lines and areas are wrapped by the dvt:referenceObjectSet tags. Example 24–8 shows the code for three reference areas associated with the y1-axis, one reference area associated with the y2-axis, and four reference lines associated with different series. Example 24–8 XML Code for Reference Lines and Areas in a Graph dvt:barGraph value ={sampleGraph.graphDataModel} graphType=BAR_VERT_CLUST2Y imageFormat=FLASH dvt:referenceObjectSet displayX1=RO_DISPLAY_AUTOMATIC displayY2=RO_DISPLAY_AUTOMATIC dvt:referenceObject index=1 type=RO_AREA association=Y1AXIS location=RO_BACK color=55FF0000 lowValue=0 highValue=4000 displayedInLegend=true text=Low dvt:referenceObject index=2 type=RO_AREA association=Y1AXIS location=RO_BACK color=55FFFF00 lowValue=4000 highValue=10000 displayedInLegend=true text=Medium dvt:referenceObject index=3 type=RO_AREA association=Y1AXIS location=RO_BACK color=5500FF00 lowValue=10000 highValue=18000 displayedInLegend=true text=High dvt:referenceObject index=4 type=RO_AREA association=Y2AXIS location=RO_FRONT color=550000FF lowValue=300 highValue=700 dvt:referenceObject index=5 type=RO_LINE association=SERIES series=0 location=RO_FRONT color=ffff66 lineValue=5000 lineWidth=3