Mazarin

Articles

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:

  1. JFreeChart API
  2. 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 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.

Pros:
  • 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.
Cons:
  • 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 APIs

Google has provided two main APIs for visual presentation of data.

  1. Google Chart API
  2. 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:

Pros:
  • 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.
Cons:
  • 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:
  • 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.
Cons:
  • 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.
  • Though the charts are in a highly usable level, use of such charts in desktop applications is not possible as rendering charts on a web page has dependency on JavaScripts.

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.

References:

  1. code.google.com/apis/visualization/interactive_charts.html
  2. www.jfree.org/index.html

Related Topics

| Share