Chapter 10. EspressChart Chart API

10.1. Introduction and Setup

In addition to designing and creating chart templates in the EspressChart Designer, EspressChart also provides an easy-to-use application programming interface (API) that enables users to create and customize 2D and 3D charts within their own applications and applets. It is written in 100% Pure Java and thus can be run on any platform with little or no modifications necessary. The chart template is completely customizable using the API. You can use as little as 4 lines of code to add a chart to another chart.

The class QbChart is used for creating a chart. Associated with this component, is a set of auxiliary classes contained within two packages: quadbase.ChartAPI and quadbase.util. The remainder of this document explains the constituents of the API and their usage.

[Tip]Tip

Please note that the complete API documentation is located at help/apidocs/index.html.

To use the API, add EspressAPI.jar and ExportLib.jar (located in the EspressChart/lib directory) to your CLASSPATH. Please note that if you are also using XML (to output the data, or to read in data), you will also need to add xercesImpl.jar and xml-apis.jar (also located in the same directory) to the CLASSPATH as well. If you wish to use to export the chart to SVG or to Flash, you will need to add SVGExport.jar or FlashExport.jar (also located in the same directory) to the CLASSPATH. If you want to use parameterized database queries as your data sources, add jsqlparser.jar to your CLASSPATH. Please note that you will also need to include qblicense.jar in your CLASSPATH. If your application is on a Windows or Solaris machine, you will have to add the following environment variable (depending on the platform):

(For Windows) set PATH=%PATH%;<path to EspressChart root directory>\lib
(For Solaris) export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:<path to EspressChart root directory>/lib