Note: This step is optional. If you do not set an image format, the default image format will be used. For more information, refer to "Changing Default Image Settings".
Next, you need to specify a format for your PopChart image. PopChart Server can serve images in a variety of formats, including SVG, MacromediaŽ Flash, PNG, GIF, PDF, EPS, and WBMP.
Note: You will need PopChart Server Pro or PopChart Server Enterprise to generate any format besides GIF or PNG. You will need PopChart Server Enterprise to generate PDF or EPS.
For information about these image formats, refer to Chapter 14 of the PopChart Server Reference manual.
To specify the image format, use imageType attribute of the PopChart Embedder, as we have done below:
myPopChart.imageType = "FLASH";
The value that you should assign to imageType is an upper-case string containing the format name. For example, we wanted a FLASH image, so we set this attribute to "FLASH". Had we wanted a PDF image, we would have set it to "PDF".
A major problem with embedding a PopChart image is deciding what image format you should display it in. Naturally, most people prefer FLASH or SVG images to GIF and PNG. But while the latter formats are almost universally supported, a browser must have a plug-in to display FLASH or SVG images. While over 90% of today's browser's support the FLASH plug-in, you would have to settle on the low-quality GIF format if you don't want to require clients to have a certain plug-in.
However, there is another option. PopChart Server's Best Image Fallback feature allows PopChart Server to serve PopChart images in the highest quality format that a client's browser currently supports.
For example, with best image fallback, if you've told PopChart Server to generate a FLASH image, but a certain browser does not have the FLASH plug-in, PopChart Server will automatically return a GIF image. Likewise, if you've told PopChart Server to generate an SVG image, but a certain browser does not have the AdobeŽ SVG Viewer, PopChart Server will automatically return a FLASH (or GIF) image.
Note: Best Image Fallback does not apply to PDF, EPS, or WBMP images. You may also be interested in the Automatic PNG Detection feature (refer to "Automatic PNG Detection"), which returns a PNG instead of GIF image if a browser supports PNG.
To request best image fallback, use fallback attribute of the PopChart Embedder, as we have done below:
myPopChart.fallback = "STRICT";
There are three different methods of best image fallback. When you enable or disable fallback, you will assign the fallback to one of these methods.
Strict fallback, for which you should assign fallback to "STRICT", instructs PopChart Server to only return an image in FLASH or SVG if the browser has the appropriate plug-in.
Loose fallback, for which you should assign fallback to "LOOSE", instructs PopChart Server to return an image in FLASH if the browser could support the plug-in. This means the browser will download a plug-in if it is not already installed. It works just like Strict fallback, however, in regards to SVG.
You can also set the fallback method to "NONE", in which case best image fallback will be disabled.
After setting the image format, you should have inserted the following code into your web page:
Example 4.4 Example Code After Choosing an Appearance File
<script language="JavaScript1.2" src="http://localhost:2001/jsEmbedder"></script>
<script language="JavaScript1.2">
<!-- // Embedding a PopChart Image
myPopChart = new PopChartEmbedder();
myPopChart.appearanceFile = "examples/apfiles/bar.pcxml";
myPopChart.imageType = "FLASH";