skip to main content
Gantt > Programmer's documentation > Developing with the JViews Charts SDK > Using the Data Model > Structure of the Data Model
 
Structure of the Data Model
The IlvDataSet Interface
The IlvDataSet interface defines the methods to access a single set of data points. A data point is defined by an (X, Y) coordinate pair expressed with double primitives, and an optional label. The IlvDataSet interface allows you to retrieve information about data points in two different ways:
*Indexed access: these requests are based on indexes of data points within the data set. They allow you to retrieve the values or the labels associated with specific data points. The following methods are available:
getXData, getYData, getDataBetween, getDataLabel.
*Spatial requests: the getDataInside method enables the caller to fetch the data points that are contained within a specified window in the data space.
When you request a set of data points, an instance of IlvDataPoints is returned. This object allows you to access both the values of the data points as well as their indices within the data set.
NOTE The IlvDataPoints instances can directly be projected with the methods defined in the IlvChartProjector interface. More information on data projection can be found in Configuring the Data Projection.
In addition to the reading operations, a data set defines the following methods to edit its contents:
*isEditable predicate
Indicates whether the data set supports editing operations.
*setData method
Allows you to change the values of an existing data point.
*addData method
Allows you to append a new data point.
The IlvDataSet interface also provides the getXRange and getYRange methods to retrieve the limits of the data values it handles. These methods can return empty ranges if the data set does not contain any data point.
Properties
Each data set handles an open-ended list of properties expressed as key/value pairs. Each property can be added or removed with the putProperty method (some predefined properties can be added or removed through the IlvDataSetProperty class). Although this feature should not be seen as an alternative to subclassing, it lets you easily add metadata information to existing data sets.
Undefined Values
In the JViews Charts library, you can specify that a data set holds data points whose values are undefined.
A data point is considered undefined when its y-value is NaN (not-a-number) or equals the value returned by the getUndefValue method. This method actually returns a Double instance, which can be null. In this case, it is assumed that all undefined data in the data set is indicated by a NaN y-value.
Undefined data points are discarded during the rendering process, as shown in Undefined Values:
Undefined Values
The IlvDataSource Interface
The IlvDataSource interface behaves as a data set provider, and acts as the bridge between the chart renderers, which define the graphical representation, and the data itself.
The contents of a data source is dynamic and its type depends on the origin of the data (extracted from a Swing TableModel or a JDBC ResultSet, read from an input source, and so on.)
For example, the contents of a data source connected to a table model changes when the structure of the underlying table changes. Likewise, the contents of a data source connected to an XML file changes upon reloading.
The IlvDataSource interface defines the methods to access the ordered collection of the provided data sets:
*for reading operations:
getDataSetCount, getDataSet, getDataSets
*for writing operations:
addDataSet, setDataSet,
setDataSets

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