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 the Add button. A dialog will open prompting you to specify a display name and the location of the class file you want to use.

Add Class File Dialog

There is sample code available in 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 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 way as query parameters. For more information about setting up a parameterized class file data source, please see Appendix 10.A.5 - Data Passed in your Custom Implementation.