4.5. Data from Class Files

For maximum flexibility, EspressChart allows you to design charts using object or array data, by providing an interface to pass data to the chart Designer as an argument. Using the API, you can implement IDataSource to return an IResultSet object similar to the java.sql.ResultSet interface used for JDBC result sets. Users can provide their own implementation of IResultSet, or use one provided by EspressChart.

For more information about this feature please see Section 10.5.3.4 - Data from Custom Implementation.

To add a class file as a data source, select the ClassFiles node in the Data Source Manager, and click Add. A dialog will open prompting you to specify a display name, and the location of the class file that you would like to use.

Add Class File Dialog

There is sample code available in the help/examples/DataSources/classes directory of the installation. The complied code will generate a class file that passes the data array into ChartDesigner. Note that in order to use a class file as a data source, you must have the file or directory containing the package in your classpath (or the -classpath argument of the EspressManager.bat or EspressManager.sh file when using ChartDesigner).

4.5.1. Parameterized Class Files

EspressChart provides an additional API interface, IParameterizedDataSource, that allows you to define chart parameters within the context of a class file data source.

Parameters that are defined within the context of a class file work in the same manner as query parameters. For more information on setting up a parameterized class file data source, please see Appendix 10.A.5 - Data Passed in your Custom Implementation.