skip to main content
Programmer's documentation > Developing with the JViews Charts SDK > Using JViews Charts JavaBeans > Data source beans
 
Data source beans
Describes the two default data source beans provided with the JViews Charts library.
*The IlvXMLDataSource bean
*Describes the IlvXMLDataSource bean.
*The IlvJDBCDataSource bean
*Describes the IlvJDBCDataSource bean.
*The IlvSwingTableDataSource
*Describes the IlvSwingTableDataSource class.
The IlvXMLDataSource bean
The IlvXMLDataSource bean allows you to import data from an XML file, and to display it in an IlvChart bean. The data file should be conform with the JViews Charts DTD as defined in Using the Data Model.
 
Property
Description
Default value
filename
The URL of the data file
none
The location of the XML file to load is defined by the filename property. The location can be expressed either as a file name or as a URL.
You can find more information in XML file format in Using the Designer.
The IlvJDBCDataSource bean
The IlvJDBCDataSource bean allows you to import a data model from a database using the JDBC API.
You can find more information on the JDBC API at http://java.sun.com/jdbc.
The IlvJDBCDataSource bean is configured according to an initialization string defined by means of a dedicated property editor. The property editor is accessible by editing the data source connectionParams property in your IDE, and appears as in JDBC Editor:
JDBC Editor
General properties
Property
Description
Default value
databaseURL
The database URL of the form jdbc:subprotocol:subname
none
driverClassname
The full class name of the JDBC Driver
none
user
The database user
none
password
The user’s password
none
query
The SQL query to execute
none
xSeriesIndex
The x-series column index in the query
-1
dataLabelsIndex
The index of the data labels column in the query
-1
Connection parameters
The connection to the database is performed by a JDBC driver that requires specific information to connect to the database. This information is defined by the following properties:
*databaseURL
Identifies the data source as a JDBC URL. A JDBC URL is used to find the appropriate driver able to establish the connection. This URL is of the form jdbc:subprotocol:subname, where <subprotocol> is the name of a database connectivity mechanism and <subname> a database vendor-dependent parameter used to identify the data source. For example, a JDBC URL for an Oracle database using the Oracle JDBC thin driver looks like:
jdbc:oracle:thin:@myserver:1521:mydatabase
Please refer to your database documentation for more information on how to open a connection using JDBC.
*driverClassname
Defines the full class name of the JDBC driver to use, for example oracle.jdbc.driver.OracleDriver.
*user
Defines the database user who opens the connection.
*password
Defines the user’s password.
Data sets parameters
Data sets are built from a ResultSet resulting from the execution of a query. Once the query has been executed, the result set is parsed, and data is extracted to initialize the corresponding data sets.
The following properties are involved in the data set creation:
*query
Defines the query to execute, expressed as an SQL statement.
*xSeriesIndex
Specifies the index of the column in the result set that contains x-values.
Depending on your data, you may or may not have defined specific x-series for the data points. If you do not specify any x-series, then the index of the data points in their data set is used. By default, no x-series column is specified, and the property is set to -1.
*dataLabelsIndex
Specifies the index of the column in the result set that contains data labels. By default, no data label column is specified and the property is set to -1.
The IlvSwingTableDataSource
The IlvSwingTableDataSource allows you to import data from a Swing table model (instance of javax.swing.TableModel ) and to display it in an IlvChart bean.
NOTE To be properly imported, a table model must contain data whose type is compatible with the supported data type.
Refer to the section Data Source Classes for more information on the supported data type.
 
Property
Description
Default value
dataLabelsIndex
The index of the data labels column in the table model.
-1
seriesType
The type of the series order (by rows or by columns).
COLUMN
tableModel
The javax.swing.TableModel instance to attach.
null
xSeriesIndex
The x-series column index in the table model.
-1
TableModel parameters
To determine how a TableModel is imported as a chart data model, the IlvSwingTableDataSource defines the following properties:
*tableModel: Defines the javax.swing.TableModel instance to connect.
*seriesType: Defines the type of the series. The IlvSwingTableDataSource supports two types of series ordering: by columns or by rows.
Data sets parameter
Once a table model has been connected to an IlvSwingTableDataSource, the corresponding data sets are created and initialized according to the following properties:
*dataLabelsIndex: Specifies the index of the column in the result set that contains data labels. By default, no data label column is specified and the property is set to -1.
*xSeriesIndex: Specifies the index of the column in the result set that contains x-values.
Depending on your data, you may or may not have defined specific x-series for the data points. If you do not specify any x-series, then the index of the data points in their data set is used. By default, no x-series column is specified, and the property is set to -1.

Copyright © 2018, Rogue Wave Software, Inc. All Rights Reserved.