Imported Graphics

Another new feature in PopChart Server 4.0 is the ability to import graphics into an appearance file. This can be useful if you want to have an image as the background of your graph, or if you want to use a logo in all of your PopChart images.

You can import graphics from the following formats: GIF and JPEG.

Note: JPEG images do not import well into PopChart XML 4.0. You will need to save your appearance files in PopChart XML 4.0.1 format to take full advantages of imported JPEG images. To do this, go into PopChart Builder, select Edit > Preferences > Save and check the Save Using Latest PCXML Format box. You must be running both PopChart Server 4.0.1 and PopChart Builder 4.0.1 for this to work.

Warning: If the image file that you import is extremely large, it can seriously decrease PopChart Server's performance.

Adding Imported Graphics to Your Appearance File

You can import a graphic into your appearance file using PopChart Builder. Simply click on the Add an image icon and locate the image you want to import. You can resize it, set its transparency, and add a border in the PopChart Builder interface.

Note: Because PopChart Builder must encode your image, you cannot dynamically add an image object to your appearance file. The best you can do is create a separate appearance file containing just your image and then overlay it (refer to "Adding Objects to Your Appearance File"). An alternative strategy is to import a placeholder image into the appearance file. You could change its source dynamically, or you could hide it if you end up not needing it.

Changing the Graphic Source

You can change the source of an image using the bitmap. LoadFile() PCScript command. This command accepts one parameter—the source of the new graphic. You can load a graphic from a local file, or from a URL.

Important: In order for PopChart Server to load any image, it must be given permission to read data from the specified path or domain. See "Setting Path Permissions" in Chapter 3 for more information.

Assuming you have an graphic named bitmap, you could change its source to the cordalogo.gif file from the examples/images directory using the following PCScript:

bitmap.loadFile(examples/images/cordalogo.gif)

Note: You cannot change the source of an image using PCXML.

Drill-Down for a Text Box

You can also enable drill-down effects for an image. For information about drill-down effects in general, see "Drill-down Effects" in Chapter 7.

PCScript

To add a drill-down effect to an image, simply use the bitmap. DDEnable() method. For example, to add a drill-down link from a text box named textbox to http://mycompany.com, you would use the following PCScript command:

bitmap.DDEnable(http://mycompany.com)

PopChart XML

To add a drill-down effect to an image with PopChart XML, simply add a Drilldown attribute to your Image element, as shown in the example below.

<Image Name="bitmap" Drilldown="http://mycompany.com" />

Hiding a Graphic

Another useful feature is the ability to hide a graphic. If your appearance file already contains an imported graphic, but you don't want to show it in certain instances, you can use PCScript or PopChart XML to turn it off.

PCScript

To hide a graphic in PCScript, simply use the bitmap. Hide() method. For example, if your image object is named bitmap, you can make it disappear with the PCScript command shown below.

bitmap.Hide()

PopChart XML

To hide a graphic in PopChart XML, simply override its Visible attribute to false. For example, if your image object is named bitmap, you could hide it with the following PopChart XML.

<Image Name="bitmap" Visible="false" />