The tile controller
A tile controller is an instance of the
IlvDataTileController class, which implements the load-on-demand strategy. To do so, the tile controller divides the
x-axis into a number of equal intervals called
tiles. This operation is performed according to two parameters specified in the controller constructor:
The
tile origin, which represents the minimum
x-value of the first tile.
The
tile length, which represents the extent of a tile along the
x-axis.
Each tile is represented by an instance of the
IlvDataTile class. It is identified by a specific integer that corresponds to its location relative to the tile origin.
Tiling of the Visible Range of a Chart
Each time a tile becomes visible due to a change in the visible range of an x-axis, the tile controller notifies the tile loader to fetch the data attached to this tile. Each loaded tile is locked by the object that triggered the loading request, and unlocked by the same object when data is no longer used. This ensures that the data actually displayed is kept in memory, while the data that is no longer in the visible range of the chart is put in a cache for potential reuse.
Each load-on-demand data set owns a tile controller. When these data sets are connected to a chart, the load-on-demand mechanism is activated so that the changes in the visible range of the
x-axis of the considered chart are translated into loading requests (it is said that load-on-demand is
event-driven). This translation is performed by the
axisRangeChanged method, whose default implementation is to request the loading of tiles that intersect the new visible range of the corresponding axis. You can override this method to pre-load neighboring data.
For example, a data set may expand the new visible range by a given factor before sending the loading request, thus anticipating further scrolling or zooming.
Although tile loading is event-driven, you can also explicitly use the
requestLoading method to load data for a given
x-interval. In the same way, the
lock and
unlock methods let you manually lock or unlock tiles to prevent them from being released.
The
IlvDataTileController is the core class of the load-on-demand mechanism, while
IlvLODDataSet is the bridge to the chart data model. Each load-on-demand data set must be created with its tile controller, as shown in the following code extract:
IlvDataTileLoader loader = ...; IlvDataTileCache
cache = ...; double tileOrigin = 0; double tileLength
= 200; int tileCapacity = 200; IlvDataTileController
ctrl = new IlvDataTileController(loader, cache, tileOrigin,
tileLength, tileCapacity); IlvLODDataSet
dataSet = new IlvLODDataSet(ctrl);
The tileLength parameter represents the extent of a tile along the x-axis.
The tileOrigin parameter represents the minimum x-value of the first tile.
The tileCapacity parameter represents the maximum number of data points a tile can hold. The controller uses this capacity to provide indexed access to data points through the data set.
Copyright © 2018, Rogue Wave Software, Inc. All Rights Reserved.