Structure of the extended data model
Rogue Wave® JViews Charts offers a set of extended data models that are particularly useful to display charts of structured objects.
The extended data models have the following characteristics:
They are particularly appropriate to connect data to a data source when you want to create a treemap chart.
In theory, you could connect your data directly to the
IlvTreeTableDataSource, but it is easier to connect it to one of the extended data model classes.
They can hold objects of any type (string or object).
For example, the
IlvDataSet interface holds mostly numeric values.
They can be easily connected to Swing models.
For example, they can be wrapped into Swing TableModel, TreeModel or TreeTableModel instances. This allows you to display the data in your application not only with a Charts view, but also with a Swing view.
Also, existing instances of Swing TableModel, TreeModel, TreeTableModel, or ListModel can be viewed through a facade of extended data models. This allows you to display in a chart any data that is already displayed in a Swing view.
Connecting to Extended Data Models
Extended Data Models
The extended data models are defined in subpackages of the package
ilog.views.chart.datax.
Extended Data Models lists the available data models and illustrates their main characteristics:
Extended Data Models
Data Model | Structure | Row Entity | Columns or Attributes |
| tree, ordered | object with attributes | yes |
| tree, unordered | object with attributes | yes |
| flat, ordered | object with attributes | yes |
| flat, unordered | object with attributes | yes |
| flat, ordered | index or list of cells | yes |
Swing TreeTableModel | tree, ordered | object with attributes | yes |
Swing TreeModel | tree, ordered | object | no |
Swing TableModel | flat, ordered | index or list of cells | yes |
Swing ListModel | flat, ordered | object | no |
Tree Data Model
In a tree data model, each object has a set of children objects. If the set of children is empty, the node is called leaf node.
If the set of children is not empty and there is only one node which is not the child of another node, the node is called root node. If the tree data model is empty there is no root node.
Ordered Data Model
In an ordered data model, the order of objects is relevant. In a tree data model, the order of the children of each object is also important. This does not mean that they are sorted by a particular criterion. This means that when an object X is inserted between A and B, the iterator will return the objects in the order A - X - B.
Unordered Data Model
In an unordered data model, the iterator order is unpredictable and objects cannot be addressed by indices.
Flat Data Model
In a flat data model, there is no parent/child relationship between objects. All objects are at the same level.
An object with attributes is an object which holds values for some given keys. When presented in tabular form, the attribute names become column names, and the attribute values become table cell values.
For example, if you have two objects Greg and Fred, with attributes Date of Birth, State of Birth, Income, defined as follows:
Greg.getValue("Date of birth") = 1947 Greg.getValue("State of birth") = MA Greg.getValue("Income") = 81000 Fred.getValue("Date of birth") = 1953 Fred.getValue("State of birth") = CA Fred.getValue("Income") = 72000 the tabular form would look like this:
Object | Date of Birth | State of Birth | Income |
Greg | 1947 | MA | 81000 |
Fred | 1953 | CA | 72000 |
Choosing the data model to implement
When you instantiate an
IlvTreeTableDataSource, you have to choose the type of data model through which you connect to it. The data model has to be an instance of
IlvModelWithColumns, and you can choose among the following ones:
Data is structured in some obvious and inherent way and the order is important.
Data is structured in some obvious and inherent way and the order is not important.
Data is represented in a way that a row corresponds to a single object and the order is important.
Data is represented in a way that a row corresponds to a single object and the order is not important.
Data is structured in a tabular form, where each cell represents a single object.
Copyright © 2018, Rogue Wave Software, Inc. All Rights Reserved.