What Happens When You Create Reference Lines or Areas During Design

Using ADF Graph Components 24-45 products P1, P2, P3, P4, when you move the cursor over product P2 in January, all the P2 bars are highlighted, and the P1, P3, and P4 bars are dimmed. Because the graph refers to all the data markers in a given set of data such as all the P2 bars as a series, then the ability to highlight the data markers in a series is part of the graph’s series rollover behavior feature. Series rollover behavior is available only in the following graph types: bar, line, area, pie, scatter, polar, radar, and bubble graphs. To dim all the data markers in a series: 1. In the Structure window, right-click the graph node and choose Go to Properties. 2. In the Appearance attributes category, in the SeriesRolloverBehavior field, use the dropdown list to select RB_DIM.

24.8.4.2 How to React to Changes in the Zoom and Scroll Levels

You can provide custom code that will be executed when the zoom and scroll levels change on a graph. In a managed bean you store methods that takes as input a ZoomEvent or ScrollEvent. With these events, users can determine which axis is zoomed, as well as the current extent of the zoomed axes. To provide custom behavior in response to zooming and scrolling in a graph: 1. In a managed bean, write a custom method that performs the desired behavior when a zoom or scroll event is triggered. Example 24–11 shows sample code for creating this method.

2. In the Structure window, right-click the graph node and choose Go to Properties.

3. Select the Behavior attributes category and expand the Advanced node and do

one or both of the following: ■ In the zoomlListener field, specify a reference to the method that you stored in the managed bean. For example, if the method setZoom is stored in the managed bean SampleGraph, then the setting becomes: {sampleGraph.zoom. ■ In the scrollListener field, specify a reference to the method that you stored in the managed bean. For example, if the method setScroll is stored in the managed bean SampleGraph, then the setting becomes: {sampleGraph.scroll. Example 24–11 Sample Code to Set Zoom and Scroll Managed bean sampleGraph.java public void setZoomZoomEvent event { System.out.printlnStart Group: + event.getAxisStartGroupZoomEvent.O1AXIS; System.out.printlnGroup Count: + event.getAxisGroupCountZoomEvent.O1AXIS; System.out.printlnStart Group Label: + event.getAxisStartGroupLabelZoomEvent.O1AXIS; public void setScrollScrollEvent event { System.out.printlnEnd Group Label: + event.getAxisEndGroupLabelScrollEvent.O1AXIS; System.out.printlnAxis Min: + event.getAxisMinScrollEvent.O1AXIS; System.out.printlnAxis Max: + 24-46 Web User Interface Developers Guide for Oracle Application Development Framework event.getAxisMaxScrollEvent.O1AXIS;

24.8.5 Providing an Interactive Time Axis for Graphs

You can define relative ranges and explicit ranges for the display of time data.

24.8.5.1 How to Define a Relative Range of Time Data for Display

You can define a simple relative range of time data to be displayed, such as the last seven days. This will force old data to scroll off the left edge of the graph as new data points are added to the display of an active data graph. Relative time range specifications are not limited to use in active data graphs. To specify a relative range of time data for display: 1. In the Structure window, right click the graph node and choose Go to Properties. 2. In the Appearance attributes category, expand the dvt:timeAxis node and specify values for the following attributes:

a. In the timeRangeMode attribute, specify the value TRM_RELATIVE_LAST

or TRM_RELATIVE_FIRST depending on whether the relative range applies to the end of the time range such as the last seven days or to the beginning of the time range such as the first seven days. b. In the timeRelativeRange attribute, specify the relative range in milliseconds.

24.8.5.2 How to Define an Explicit Range of Time Data for Display

You can define an explicit range of time data to be displayed, such as the period between March 15 and March 25. In this example, the year, hour, minute, and second use default values because they were not stated in the start and end values. To specify an explicit range of time data for display: 1. In the Structure window, right click the graph node and choose Go to Properties. 2. In the Appearance attributes category, specify the values for the following attributes:

a. In the timeRangeMode attribute, specify the value TRM_EXPLICIT.

b. In the timeRangeStart attribute, enter the initial date for the time range. c. In the timeRangeEnd attribute, enter the ending date for the time range.

24.8.6 Adding Alerts and Annotations to Graphs

Alerts define a data value on a graph that must be highlighted with a separate symbol, such as an error or warning. An icon marks the location of the alert. When the cursor moves over the alert icon, the text of that alert is displayed. An unlimited number of alerts can be defined for a graph using dvt:alert tags. The alerts are wrapped in a dvt:alertSet tag, that is a child of graph tag. Example 24–12 shows a set of alerts for an area graph. Example 24–12 Sample Code for Set of Graph Alerts dvt:areaGraph dvt:alertSet dvt:alert xValue=Boston yValue=3.50 yValueAssignment=Y1AXIS imageSource=myWarning.gif