Image Generation

Although Chart FX for Java was designed so the user can take advantage of the browser capability to display Active Charts, many developers want to stay away from client-side components and want to force image generation no matter what kind of browser or OS the client is using. Chart FX for Java is even more powerful as it allows you to generate Image Maps which will allow your users to click on a particular chart marker that has been defined as a link in the code. Therefore, chart images are no longer static images since you can actually create entire applications based on the images created by Chart FX for Java.

Forcing Chart FX for Java Server to Generate Images

In order to force Chart FX for Java to always generate images, you must change the getHtmlTag method and prevent the automatic Browser Detection capability. If you change the third parameter of the getHtmlTag method to "Image", the Chart FX for Java Server-side Java bean component will generate images no matter what the browser being used to access the page is. In order to generate images, your getHtmlTag method call should look like:


<%=chart.getHtmlTag(500,300,"Image")%>

What image formats can Chart FX generate?

If you read the getHtmlTag definition carefully, you'll notice that "PNG" and "JPEG" are supported as possible parameters (instead of "Image"). This means Chart FX for Java is capable of generating JPEG and PNG images.

PNG Images

The PNG algorithm is particularly effective for drawing vector images (such as charts), as images will experience no quality degradation or color dithering. This format came as a response to Unisys prohibiting the public distribution of the GIF generation algorithm. This format is even better in terms of quality and compression than GIF and supports many more features, such as transparency, interlaced, 24-bit palettes and many other advantages over GIF images.

This means PNG is the preferred image format for Chart FX for Java. However, the drawback is that many older browsers do not support this image format. Therefore, the JPEG format is also available for these older browsers.

JPEG Images

This format was created to compress and display photo quality images (not vector images such as charts). As a result, displaying charts using this algorithm is not advisable as you will obtain quality degradation and color dithering when creating JPEG images.