Use of Data Visualization API in Web Applications
When presenting data as information, there is no better way than using charts and graphs which adds a graphical element to the eyes of the viewers. A Management information system (MIS) needs to provide timely information in a flexible and appealing manner so that users, usually the decision makers of a company, can easily understand the big picture of the organization, comprehensively as well as effortlessly. There are several APIs which can be used in Java web applications to display such information in presentation rich chart formats. Suitable APIs that are commonly in use are:
- JFreeChart API
- Google APIs (Google Chart API and Visualization API)
In addition to the above two there are some other APIs available today by various parties such as Flex by Adobe, JavaFX by Sun. Adobe Flex is a popular API which is used to build highly rich user interfaces.
The following provides a brief comparison between two main Visualization APIs namely, JFreeChart API and Google API.
JFreeChart is Java based API for graphical representation of data. Though the API binaries can be downloaded free of charge, the user guide of the JFreeChart API is provided at a cost. There are some pros and cons in using this API in applications.
- Provides a range of chart types including Pie charts, Bar charts, Column charts, XY scatter diagrams and gauge type diagrams which are commonly in use. Thus a developer can have several choices according to business needs, when selecting appropriate chart type for their project.
- Easy integration with Java applications enables saving time in configuration and use of the API.
- Provides many features in order to have rich presentation for end users, such and custom labels on charts where necessary, zoom out and zoom in features are presented.
- Inbuilt support for some 3rd party APIs such as JasperReports makes developers to avoid boilerplate coding for communication between such components/APIs and the chart API.
- This API is not lightweight. In the case of the presentation layer of a web application, Jfree-chart provides only an image of a chart. Thus feature rich web application has a constraint with this, in such cases user actions on the graph should be handled by a separate handler. For example zoom in/out cannot be made available for web applications oppose to desktop applications.
- JFreeChart consumes high resource of the server where the application is hosted. This may become an issue when performance fine tuning of the application on the specific environment is done.
Google has provided two main APIs for visual presentation of data.
- Google Chart API
- Google Visualization API
Google chart API (image chart API) provides image of the chart to be shown where as Google Visualization API provides interactive charts, which are capable of some degree of response for user actions on the chart. For example a user can click on a bar or column in the chart and see some textual information about the information.
Google Chart API:
- The API is very easy to use and can be integrated into a web application with considerably lesser time. Time taken to gain technical knowledge, in order to use the API is reasonably less.
- Processing of data for charts is delegated to a 3rd party server, thus optimum use of server resources can be achieved. Only performance issue is the impact on rendering such a chart on the browser.
- Very loosely coupled design between application and the API. Thus there is very less impact when responding to frequent changes.
- Since the API is loosely coupled same techniques can be used by applications built using any technology and the knowledge gained can be shared among developers.
- There are limitations for chart images that are generated by the API.
- Depends on 3rd party API which is not packed with the application. Thus unavailability of such 3rd party services makes displaying graphical form of data impossible.
Google Visualization API:
- Pros are very similar to those of Google Chart API.
- In Addition, the Visualization API provides interactive charts. Such charts provide higher degree of user interaction. For example users can get more information from the chart by clicking on data points or columns in the chart.
- Combination of the Chart API and Visualization API provides highly user friendly way of presenting information in a graphical manner.
- The computer that hosts the application needs to have Internet access to reach the Google servers that hosts the API.
- As stated in Cons section of the Google Chart API, dependencies on 3rd party API which are not packed with the application makes displaying graphical form of data impossible.
Finally both APIs provide various features which are required for applications that are being developed today. But Google has a smarter solution compared to others by providing feature rich APIs that has fewer configurations overhead for web applications.