12.2. Deploying with EspressManager

This section deals with deploying chart components that work in conjunction with EspressManager. To learn more about the interaction, please refer to the Section 10.3 - Interaction with EspressManager.

Note that any references to a data source or to a chart file, using the relative URL reference (i.e. help\examples\data\sample.dat) are relative to the directory from where EspressManager is running in.

12.2.1. Chart Designer

As mentioned before, Chart Designer must be used in conjunction with EspressManager. Chart Designer can be called using the API. Note that in this scenario, you will have to add ChartDesigner.jar in your CLASSPATH and place a copy of the images (EspressChart/images), and the backgroundImages (EspressChart/backgroundImages) directories under the working directory of the .class file.

Instead of copying the directories relative to the working directory when invoking the Chart Designer from API, an option to set the location images/ and backgroundImages/ directory is also available. Simply use a QbchartDesigner constructor with the parameter imagesPath. For more details about the QbchartDesigner constructor or the imagesPath parameter, please refer to the Chapter 10 - EspressChart Chart API.

To connect to EspressManager running as an application, you use the following two API methods in QbchartDesigner to set the connection information:

static void setServerAddress(java.lang.String address);
static void setServerPortNumber(int port);

To connect to the EspressManager running as a servlet, you use the following three API methods in QbchartDesigner to set the connection information:

static void useServlet(boolean b);
static void setServletRunner(String comm_url);
static void setServletContext(String context);

Please note that specifying the connection information to EspressManager must be made before calling any QbChartDesigner constructors.

12.2.2. Chart Viewer

Deploying Chart Viewer is similar to deploying Chart Viewer. Chart Viewer can be used in Java Web Start Application to show a chart saved in a .cht or .tpl file (either generated by Designer or API).

EspressViewer.jar must be included in the HTML file as the archive in order to deploy Chart Viewer in a Java Web Start Application.

To use Chart Viewer, construct an HTML page with the proper applet code (for more details, please refer to Chapter 9 - Chart Viewer). Note that any relative references to the chart location and/or data are relative to the directory from where EspressManager has been started.

To connect to EspressManager running as an application, you must pass the following parameters to the Chart Viewer:

server_address (server address), server_port_number (port number)

To connect to EspressManager running as a servlet, you pass the following parameters to the Chart Viewer:

comm_protocol (servlet), comm_url (machine name/IP address and port number), servlet_context (servlet context)

12.2.3. Chart API

Chart API can be used in Java Web Start Application. Chart API can also be used in a servlet or jsp environment to generate server-side charts.

To deploy Chart API, EspressAPI.jar and ExportLib.jar must be in the CLASSPATH (for application and servlet/jsp environment) or included in the HTML file.

To connect to EspressManager running as an application, you would use the following methods in QbChart to set the connection information:

static void setServerAddress(java.lang.String address);
static void setServerPortNumber(int port);

To connect to EspressManager running as a servlet, you would use the following methods in QbChart to set the connection information:

static void useServlet(boolean b);
static void setServletRunner(String comm_url);
static void setServletContext(String context);

Please note that specifying the connection information to EspressManager must be made before calling any QbChart constructors.