EXAMPLE 1
TAdvStringGrid
example 75 : Automatically connect TAdvStringGrid to TAdvChartView with TAdvChartLink
In many cases the data that should be visualized in a chart is already available in a grid. Typically, it is also desirable that a chart automatically updates when the values in the grid change. To assist in this frequently occuring scenario, we have created the component TAdvChartLink that is a bridge between data in the grid and data in series of the TMS TAdvChartView. TAdvChartLink connects to a grid (TAdvStringGrid, TDBAdvGrid, TAdvSpreadGrid, TAdvColumnGrid) and a chartview TAdvChartView or TAdvGDIPChartView. Data in a specified range of cells can be connected to any serie in any pane of the chartview.Steps to get started:
- 1) drop a TAdvStringGrid (or descendent class) on the form
- 2) drop a TAdvChartView (or descendent class) on the form
- 3) drop one or more TAdvChartLink components on the form
- 4) assign the grid to TAdvChartLink.Grid and the chartview to TAdvChartLink.ChartView
- 5) Configure the chartview to have the number of series and serie properties that you want to display
The data is specified via TAdvChartLink.GridValues:
DataTypes:
dtNormalColumn : data comes from normal cells (not fixed cells) in a column specified by Column
dtFullColumn : data comes from all cells (normal & fixed cells) in a column specified by Column
dtNormalRow : data comes from normal cells (not fixed cells) in a row specified by Row
dtFullRow : data comes from all cells (normal & fixed cells) in a row specified by Row
dtNodeLevel : data comes from normal cells (not fixed cells) in a column specified by Column only for rows that have a node with level set by NodeLevel
dtCellRange : data comes from cells specified by Left/Right Top/Bottom coordinates
As soon as TAdvChartLink.Active is set true, the specified data of the grid will be synchronized with the chart serie. When the grid values are updated via editing, the serie in the chart will also be automatically updated. When changing the grid programmatically, call TAdvChartLink.Synchronize to programmatically force an update.
Delphi project & source files for downloading included in the main demos distribution for Delphi.
The project and source files have been written with Delphi 2007. To use these files in other versions of Delphi, ignore any remarks when opening the form files and save the files. After this, compilation can be done. The error messages are due to properties included in the Delphi 2007 form file, but not available in lower versions of Delphi.

ONLINE ORDERS
Subscribe to RSS Feed