UltraLightClient Code Community
[ start | index | login ]
Overview > JFreeChart Extension I

JFreeChart Extension I

Belongs to following categories: Graphic, ULC6.0,

Purpose

Many business applications need to display charts. This contribution shows how the free chart library >>JFreeChart can be integrated into ULC applications.

The integration is entirely done on the server side. This approach has the advantage that beside the standard ULC libraries and a small extension no additional libraries have to be deployed on the client. As a drawback, since the >>JFreeChart library heavily relies on Java2D, the integration will not work for server configurations without headless support.

The contribution also shows how the chart can be printed. There are two options: displaying the chart inside an HTML page or creating a PDF document that contains the chart. The latter is achieved by using the free >>iText library.

Difference between JFreeChart Extension I and II

If your goal is to create simple charts without the possibility to change their appearance or to zoom in and out on charts in an interactive way, then this contribution suits you the best. If you want to get all interactive functionalities of JFreeChart (especially the mouse event handling and zooming), then the JFreeChart Extension II is the more appropriate solution for you.

Related to

This contribution is related to JFreeChart Extension II.

Resources

How to use

After starting the application, a window is displayed (>>screenshot). The window contains the chart and a set of text fields and controls to customize the chart (such as chart type, title, etc). By right-clicking on the chart, a popup menu shows up with menu entries for creating new random chart data and for displaying the chart inside an HTML page or a PDF document.

Resizing the window automatically adjusts the chart size.

How it is implemented

The core of the contribution are the ULCJFreeChartComponent and the UIJFreeChartComponent. The ULCJFreeChartComponent provides an API to set a JFreeChart chart and register an IJFreeChartComponentListener to receive notifications when the chart size changes. The ULCJFreeChartComponent converts the chart into a PNG image and sends it to the UIJFreeChartComponent. The UIJFreeChartComponent then displays the chart image. When the user resizes the component enclosing the chart image, the new size is sent to the ULCJFreeChartComponent which then creates a new chart image of the appropriate size and sends it back to the client.

Compatibility

The described functionality has been developed and tested using JDK 1.3.1_09, JDK 1.4.2_01, ULC 6.0.2.1, iText 1.3, and JFreeChart 1.0.0.

Author

>>thomas

no comments | post comment
labels
Category:Graphic
Category:ULC6.0
attachments
IntegrationDemo.gif (53488)
jfreechartintegration.zip (10720)
Created by marc.hermann. Last edited by admin, one year and 245 days ago. Viewed 13,252 times. #12
[diff] [history] [edit] [rdf]




news




RSS News Feed:

RSS Feed

snipsnap.org | Copyright 2000-2002 Matthias L. Jugel and Stephan J. Schmidt