Справочник функций

Ваш аккаунт

Войти через: 
Забыли пароль?
Регистрация
Информацию о новых материалах можно получать и без регистрации:

Почтовая рассылка

Подписчиков: -1
Последний выпуск: 19.06.2015

Построение графиков.

9.6K
17 февраля 2005 года
SFes
2 / / 10.02.2005
Где можно взять компонент для построения графиков по данным из БД? Для Делфи-6
259
17 февраля 2005 года
AlexandrVSmirno
1.4K / / 03.12.2004
Цитата:
Originally posted by SFes
Где можно взять компонент для построения графиков по данным из БД? Для Делфи-6


Unit

Chart

Ancestor

TCustomChart

Description
TChart is the most important component in TeeChart library. TChart derives from TPanel and inherits all its functionality. In short, TChart is a standard Delphi TPanel component with many new capabilities specific to charting and graphing purposes.
TChart is the ParentChart component for Series.

You can create Chart components both at design and run-time.
Many charts can exist in a Form.
TeeChart components can be also in an ActiveX Form.

For an indepth look at how to create Charts with TeeChart see the TeeChart User Guide.

TDBChart derives from TChart and inherits all its functionality. When a Chart Series is connected to a TDBChart component, TDBChart looks in the Series DataSource property.

The datasource for the Series is defined by the Series definition - not by the Chart - Thus multiple Series in a TDBChart could access different data sources. However, if those Series are not associated, via ParentChart, with a TDBChart then the option to define a Series database-datasource won’t be available.

Creating the Dataset
TeeChart Charts will connect with 3 different types of Dataset.
TTable
TQuery
TClientDataset
The minimum that requires to be set in each case is:
The name of the database,
For the table the TableName of a table
or
in the case of the query a valid SQL string.
or
in the case of a ClientDataset Define source (right button on TClientDataset object in form).
Remember to activate the Dataset by setting the Active property to True.

Connecting your Series to a database Dataset
In 'Getting Started' you saw how to connect a data Series to a database dataset. Let’s recap here on the key components.
When you select your new Series in the Chart Editor Series page you will see the tab option for Data Source. If you want your data Series to be connected to a new dataset then you should select Dataset from the drop down combo listbox. A new selector box will appear with the options for definition of the new dataset.

The exact contents of the page will change depending on the Series type you have chosen. The parameters you set here modify the properties in the Series definition which vary between Series type. The following table shows the possible options for normal Series types (function Series are different).


SERIES TYPE DATASOURCE PROPERTIES
Basic
Line XValues, YValues, XLabel
Fast Line XValues, YValues, XLabel
Bar XValues, YValues (called Bar), XLabel
Area XValues, YValues, XLabel
Point Xvalues, YValues, XLabel
Pie PieValues, XLabel
Arrow StartXValues, StartYValues, XLabel, EndXValues, EndYValues
Bubble Xvalues, YValues, XLabel, RadiusValues
Gantt StartValues, EndValues, AY (Y axis level), AXLabel (Label optionally shown on Y-axis or as mark)
Shape X0 (Top), Y0 (Bottom), X1 (Left), Y1 (Right)
Extended
Bezier XValues, YValues, XLabels
Candle OpenValues, CloseValues, HighValues, LowValues, DateValues
Contour XValues, YValues, ZValues, Labels
Error Bar XValues, YValues, XLabel, ErrorValues
Polar XValues, YValues
3D Surface XValues, YValues, ZValues
Volume XValues, YValues (VolumeValues), XLabel
Coding your datasource
You may populate your Chart at runtime by coding which Series to add to the Chart and defining the fields of those Series.
It assumes you have a table on your form, Table1 with fields Name and Amount.

Код:
Var
MySeries,Ave:TLineSeries;

MySeries:=TLineSeries.Create( Self );
With MySeries do
begin
 ParentChart:=DBChart1;
 DataSource:=Table1;
 XLabelsSource:='Name';
 YValues.ValueSource:= 'Amount';
 CheckDatasource;
end;
Реклама на сайте | Обмен ссылками | Ссылки | Экспорт (RSS) | Контакты
Добавить статью | Добавить исходник | Добавить хостинг-провайдера | Добавить сайт в каталог