• Aucun résultat trouvé

Understanding the Chart Region

Dans le document Oracle Application Express (Page 87-91)

When editing the chart region (double-click the region or right-click and select Edit) and looking at the region definition, you might be surprised at first as there is only some HTML code in the Region Source (Figure 2-16). But remember, APEX has to include a Flash object in the page, and the way you do that is to use exactly that HTML code.

The region source consists of an object tag and an embed tag, which both have some parameters. If you look a bit deeper in that code you see the parameters of the object and embed tag are almost the same. When I first saw this code I wondered why you would want to include the same code twice. The answer is browser compatibility. In the knowledge base of Adobe (owner of Flash) it is explained well.

The OBJECT tag is used by Internet Explorer on Windows and the EMBED is used by Netscape-like browsers (Macintosh and Windows) and Internet Explorer (Macintosh) to direct the browser to load the Flash Player. Internet Explorer on Windows uses an ActiveX control to play Flash content while all other browser and platform combinations use the Netscape plug-in technology to play Flash content. This explains the need for the two tags.

CHAPTER 2  ORACLE APEX 4.0 CHARTS INSIDE OUT

Figure 2-16. The region definition of the chart

In the parameters of the object and embed tags you find parameters for quality, width, height, name, scale, and so on. The parameters either have a static value assigned to them (for example,

quality="high") or a token (for example, width="#WIDTH#"). APEX replaces these tokens when it renders the page. You can change the value of these tokens in the Chart Attributes tab (see further on). Normally you won’t change these parameters, unless you want to make the chart more dynamic and, for example, let the user define a custom loading message or change the width or height of the chart. In that case, you would replace the token with "&PAGE_ITEM.", a reference to a page item. You are responsible for giving your page item a value before APEX renders the chart, for example, by using a computation or a page process.

Figure 2-17. The region definition of the chart line by line

Figure 2-17 provides a detailed explanation of the region definition:

• Line 1 and 2 (IE) and line 23 (non-IE): Define the object classid and codebase used by Internet Explorer (IE) to identify the object and recognize it as a Flash object.

The classid identifies the ActiveX control for the browser (IE). The codebase (IE) and pluginspage (non-IE) identifies the location of the Flash Player ActiveX control (IE) or plug-in (non-IE) so that the browser can automatically download it if it is not already installed. The #HOST_PROTOCOL# is either http or https, depending on the settings in Manage Instance - Security of your Oracle APEX instance.

• Line 3 and 4 (IE), line 16 and 17 (non-IE): Define the width and height of the Flash object in pixels or % of browser window. The #WIDTH# and #HEIGHT# tokens are replaced by the value defined in the Chart Attributes.

• Line 5 (IE) and line 18 (non-IE): Define the id of the object tag in IE and the name attribute for the embed tag in non-IE. The #CHART_NAME# is replaced by c

concatenated with the region id. (See Oracle APEX view:

APEX_APPLICATION_PAGE_FLASH5.)

• Line 6 (IE) and line 20 (non-IE): Define the alignment of the Flash object.

• Line 7 (IE) and line 14 (non IE): The movie parameter in IE and the src parameter in the embed tag for non-IE browsers specifies the location (URL) of the chart to load.

• APEX ships with the AnyChart files that Oracle licensed, and this is the location they are in:

#IMAGE_PREFIX# is defined in the Application Attributes and is most likely /i/.

#CHART_TYPE# gets replaced by the chart type (for example, OracleAnyChart.swf).

#HOST# gets replaced by the webserver address.

#REGION_ID# is the region id the chart is in.

CHAPTER 2  ORACLE APEX 4.0 CHARTS INSIDE OUT

• Line 8 (IE) and line 15 (non-IE): The quality parameter can have these values: low, autolow, autohigh, medium, high, best. Oracle APEX sets it to high by default.

Low: Favors playback speed over appearance and never uses anti-aliasing.

Autolow: Emphasizes speed at first but improves appearance whenever possible. Playback begins with anti-aliasing turned off. If the Flash Player detects that the processor can handle it, anti-aliasing is turned on.

Autohigh: Emphasizes playback speed and appearance equally at first but sacrifices appearance for playback speed if necessary. Playback begins with anti-aliasing turned on. If the actual frame rate drops below the specified frame rate, anti-aliasing is turned off to improve playback speed. Use this setting to emulate the View Antialias setting in Flash.

Medium: Applies some anti-aliasing and does not smooth bitmaps. It produces a better quality than the Low setting, but lower quality than the High setting.

High: Favors appearance over playback speed and always applies anti-aliasing. If the object does not contain animation, bitmaps are smoothed; if the object has animation, bitmaps are not smoothed.

Best: Provides the best display quality and does not consider playback speed.

All output is anti-aliased and all bitmaps are smoothed.

• Line 9 (IE) and line 21 (non-IE): AllowScriptAccess controls the ability of that SWF file to call JavaScript code. AllowScriptAccess has three possible values:

always: Unconditionally turns JavaScript access on.

never: Unconditionally turns JavaScript access off.

sameDomain: Turns JavaScript access on only if the SWF file is served from the same domain and hostname as the Oracle APEX page itself.

• Line 10 (IE) and line 22 (non-IE): allowNetworking controls a SWF file’s access to network functionality. Possible values are all, internal and none. The default is all and you don’t want to change that in your APEX application.

• Line 11 (IE) and line 19 (non-IE): scale defines if the Flash object can scale.

Possible values:

default (Show all) makes the entire Flash object visible in the specified area without distortion, while maintaining the original aspect ratio of the object.

Borders can appear on two sides of the object.

noborder scales the object to fill the specified area, without distortion but possibly with some cropping, while maintaining the original aspect ratio of the object.

exactfit makes the entire object visible in the specified area without trying to preserve the original aspect ratio. Distortion sometimes occurs.

noscale prevents the Flash object from scaling when the Flash Player window is resized. This is the default in Oracle APEX.

• Line 12 (IE) and line 25 (non-IE): wmode sets the Window Mode property of the Flash object for transparency, layering, and positioning in the browser.

• Line 13 (IE) and line 26 (non-IE): FlashVars is used to send root level variables to the AnyChart Flash object. If you want to change the messages, for example, when there is no data, you do that here. These are the default messages Oracle APEX uses for the tokens:

#FLASH_INIT#: Initializing...

#FLASH_LOADING#: Loading data...

#FLASH_RESOURCES#: Loading resources...

#FLASH_NO_DATA#: No data found.

#FLASH_WAITING#: Loading data. Please wait.

#FLASH_TEMPLATES#: Loading templates...

• Line 23 (non-IE): type defines the Internet Media (MIME) type, in this case application/x-shockwave-Flash.

• Line 27 (non-IE) and 28 (IE) are the closing tags of embed and object.

• Line 29 (IE and non-IE): #CHART_REFRESH# will be replaced by some JavaScript to refresh the chart. More information about that can be found in “Understanding the Chart Attributes”.

Dans le document Oracle Application Express (Page 87-91)