If you have a commonly viewed graph that doesn't change very often, you can decrease the CPU load by having PopChart Server save the image to disk every time the data changes. Any time you want to show the image, you can have PopChart Server retrieve the saved image instead of re-generating it for every request.
If you are using the PopChart Embedder, you can save an image using the saveImageToPopChartServer(String) method. For example, Example A.1 embeds a PopChart image using the JavaScript PopChart Embedder. It also saves the image that PopChart Server returns to the location image/180091.swf.
Note: You can only save to locations that have save permissions in your path.xml file. For more information, refer to "Setting Path Permissions" in Chapter 3. You must also specify a password to save images. You can do this with the password PopChart Embedder attribute.
Example A.1 Saving an Image to PopChart Server
myPopChart = new PopChartEmbedder();
myPopChart.appearanceFile = "examples/apfiles/line.pcxml";
myPopChart.imageType = "FLASH";
You could then load the image with the PopChart Embedder loadServerSideImage(String) method. For example, Example A.2 loads the image from Example A.1 and embeds it into in a web page.
Example A.2 Loading a Server-Side Image
myPopChart = new PopChartEmbedder();
myPopChart.imageType = "FLASH";
Note: When you load a server-side, any PopChart Embedder attributes and methods that have to do with dynamic content generation (e.g. appearanceFile, loadData()) will be ignored.
You can also use the @_SAVE and @_LOAD server commands to save and retrieve images. With these, you should specify a password using @_PW.
Important: This strategy is only effective when you know that your users will be viewing images in the same format. Be sure that the imageType attribute for the image that you load and the imageType attribute for the image that you save are the same. You may need to make sure that fallback is disabled. Likewise, you will probably want to disable Automatic PNG Detection (refer to "Automatic PNG Detection"), unless you are sure all clients will support PNG.